Redmond Protocols Plugfest 2016 Andrew Davidoff Mail, Calendar, and Contacts Graph API Demonstration Senior Software Engineer
Agenda Office 365 Graph APIs: endpoints, authentication and URLs Sample Meeting Manager application API calls for Meetings, Contacts and Demonstration of API usage with Meeting Manager application Resources
How to use Microsoft Graph APIs You register your application and get Client ID and Redirect URI Use OAuth2 for authentication, get access token and use it in each request Call resource URLs using one of operations permitted on the resource: GET POST PATCH PUT DELETE All Microsoft Graph API requests use the following basic URL pattern:
What’s in URL? s] For this URL: {version} is the target service version, for example, v1.0 or beta {resource} is resource segment or path, such as users, groups, devices, organization The alias me, which resolves to the signed-in user The resources belonging to a user, such as me/events, me/drive or me/messages The alias myOrganization, which resolves to the tenant of the organization signed-in user [odata_query_parameters] represents additional OData query parameters such as $filter and $select Summary of common requests available in the Overview
Sample Meeting Manager Application Available on GitHub Samplehttps://github.com/OfficeDev/Interop-REST-Mail-Contacts-Calendar- Sample Sample code for two platforms: Android and Windows (UWP) The sample is a working application prototype and can be used as starting point or a set of building blocks to explore use of APIs Both applications log requests and responses to let you examine real-life traffic UWP application has advanced, detailed logging
Sample API Calls for Meetings and Events Calendar can be queried in two ways Events for the given time period (does not expand meeting series) Calendar view (with expanded meeting series) Query meetings for a selected date GET }&endDateTime={}$orderby=start/dateTime }&endDateTime={}$orderby=start/dateTime Get description of event instance or of event series GET Accept/decline event invitation POST Body={…}
Sample API Calls for Address Book and Contacts Query users from address book GET GET ivenName,'a') ivenName,'a') Query number of Contacts GET Query first ten contacts GET rderby=DisplayName rderby=DisplayName Get user photo GET lue lue
Some API Calls for used in the Sample In order to Reply To (or Forward) event message, the app first does a query for an event message that corresponds to the selected event: GET Subject eq '{subject}' and CreatedDateTime gt {event_created_datetime} Subject eq '{subject}' and CreatedDateTime gt {event_created_datetime} If the event message has been found, the app uses createReply, createReplyAll or createForward actions to create a draft message to be sent: POST After user clicks Send on page, the app updates created message: PATCH Body = {…} … and then sends it: POST
Demonstration: Meeting Manager
Resources Starting points for Office 365 app development: Summary of common requests available in the Overview Sample Meeting Manager application: Sample Read README.md for important details and registration steps
Redmond Protocols Plugfest 2016 Questions or Comments?
Redmond Protocols Plugfest 2016 Thank You!