Send Actionable Message via the Microsoft Graph
Running the sample
Register the application
- Go to the Application Registration Portal and sign in with either a Microsoft account or an Office 365 account.
- Click the Add an app button. Enter a name for the application and click Create application.
- Click the Add Platform button and choose Mobile Application.
- 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:
Copy the value of Application Id
Add the application ID to the project
Open the App.config file in Solution Explorer.
Find the following line:
<add key="applicationId" value="" />
Paste the application ID you copied from the portal into the
valueand 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.
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/.