This is an ASP.NET web application that uses Microsoft Graph to access a user’s Microsoft account resources from within. This sample uses REST calls through the Graph Client to the Microsoft Graph endpoint to work with user resources--in this case, to sync emails as the user. The sample also uses Bootstrap for styling and formatting the user experience.
The following are common tasks that the application performs:
- Gets consent to fetch users' folders and messages and then get an access token.
- Uses the access token to list mailboxes, list child folders and list messages in the folder.
- Stores folders and messages in local data storage
- Accesses more message pages in folders through pagination
- Uses the access token to create a subscription to a resource.
- Sends back a validation token to confirm the notification URL.
- Sends test email to activate notifications
- Listens for notifications from Microsoft Graph and respond with a 202 status code.
- Requests more information about changed resources using data in the notification.
To use the Mailbox Sync sample, you need the following:
- Visual Studio 2017 installed on your development computer.
- A work or school account.
- The application ID and key from the application that you register on the Application Registration Portal.
- A public HTTPS endpoint to receive and send HTTP requests. You can host this on Microsoft Azure or another service, or you can use ngrok or a similar tool while testing.
There are 3 components that make up the Mailbox Sample.
- Exercise 1: Getting Started
- Exercise 2: Sync folders
- Exercise 3: Sync email messages
- Exercise 4: Create subscription and receive notifications
Copyright © 2018 Microsoft Corporation. All rights reserved.