Get Started with Exchange Online REST APIs for Office 365 development in .NET
If you intend to try your hands on building an application that interacts with Exchange Online and utilizes Office 365 REST APIs for mail, calendars, and contacts, the steps below should help.
Add an Azure subscription – you can use your MSDN subscription for it
Getting Started with Your MSDN Subscription
Register your app in Azure AD and add appropriate permissions:
a. From Visual Studio 2013 using Connected service: https://msdn.microsoft.com/office/office365/HowTo/adding-service-to-your-Visual-Studio-project and http://blogs.msdn.com/b/visualstudio/archive/2014/11/19/connecting-to-cloud-services.aspx
b. From Windows Azure portal for O365 (to manually register it): https://msdn.microsoft.com/office/office365/HowTo/add-common-consent-manually
c. Outlook Dev Portal App Registration Tool
Build your application. If you are using Visual Studio to do so, you’ll need to install ADAL library through Nuget. Please also make sure you use .NET 4.5 or above if you are using latest ADAL library.
Tools you can use to understand how the flow works. You’ve an option to play with sample data or sign in and work with your own Office 365 tenant account.
(Only for authorization grant flow)
Office 365 application manifest and permission details
Understanding Oauth grant flows:
There are two grant flows:
Authorization code grant flow – this is said to run in delegation mode. The user gives assent to the app to access his own mailbox.
Client Credential flow – this is said to run in app-only mode. Also known as Daemon app or service app. The admin (tenant administrator/ global administrator) needs to give assent to the app.
Please see https://msdn.microsoft.com/en-us/library/azure/dn645543.aspx and http://blogs.msdn.com/b/exchangedev/archive/2015/01/22/building-demon-or-service-apps-with-office-365-mail-calendar-and-contacts-apis-oauth2-client-credential-flow.aspx
Important Samples in .NET:
Authorization grant flow:
Client credential flow: