Skip to content
A command-line sample that uses Microsoft Authentication Library and the Microsoft Graph Client Library to send a message with an actionable message card to the authenticated user.
C# HTML
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Properties Initial check-in Mar 1, 2017
readme-images
.gitattributes :neckbeard: Added .gitattributes & .gitignore files Mar 1, 2017
.gitignore Initial check-in Mar 1, 2017
ActivityImage.jpg Initial check-in Mar 1, 2017
AdaptiveCard.json Added adaptive support and send to others Jul 16, 2018
App.config Added adaptive support and send to others Jul 16, 2018
Card.json
LICENSE.TXT Initial check-in Mar 1, 2017
MessageBody.html Added adaptive support and send to others Jul 16, 2018
NuGet.Config Initial check-in Mar 1, 2017
Output.cs Initial check-in Mar 1, 2017
Program.cs Added adaptive support and send to others Jul 16, 2018
README.md Updating dev center links May 22, 2017
packages.config Updated NuGet packages Jul 12, 2018
send-actionable-message.csproj
send-actionable-message.sln Initial check-in Mar 1, 2017

README.md

Send Actionable Message via the Microsoft Graph

A command-line sample that uses Microsoft Authentication Library and the Microsoft Graph Client Library to send a message with an actionable message card to the authenticated user.

Running the sample

In order to run the sample, you need to register an application in the Application Registration Portal to obtain an application ID, then copy that application ID into the App.config file.

Register the application

  1. Go to the Application Registration Portal and sign in with either a Microsoft account or an Office 365 account.
  2. Click the Add an app button. Enter a name for the application and click Create application.
  3. Click the Add Platform button and choose Mobile Application.
  4. Click Save

Note: As of this writing, there is a bug in the portal that adds a Web platform entry to your registration when you click Save. If that happens, simply click the Delete button on the Web platform and click Save again.

Once you're done, the registration should look similar to this:

A screenshot of the completed app registration in the Application Registration Portal

Copy the value of Application Id

Add the application ID to the project

  1. Open the App.config file in Solution Explorer.

  2. Find the following line:

    <add key="applicationId" value="" />
  3. Paste the application ID you copied from the portal into the value and save the file. For example, using the application ID from the screenshot above, the line would be updated to:

    <add key="applicationId" value="b9831d46-3f6b-4c77-82d3-220a9ea4e5ba" />

Build and run the app

Press F5 in Visual Studio to build and run the app. A command prompt window should appear, and then a pop-up authentication window should appear.

A screenshot of the authentication popup window

Login with a Microsoft account (with an Outlook.com mailbox) or Office 365 account (with Exchange Online). Review the list of requested permissions and click Accept or Cancel. (Note: choosing Cancel will result in the app returning an error and not sending a message.)

The command prompt window should output Message sent to indicate success. Check your inbox using Outlook on the web for the message.

Modifying the message card or body

You can try different formats for the card and message body by modifying Card.json and MessageBody.html, respectively. To quickly build test card payloads, visit https://messagecardplayground.azurewebsites.net/.

You can’t perform that action at this time.