Presentation is loading. Please wait.

Presentation is loading. Please wait.

Redmond Protocols Plugfest 2016 Andrew Davidoff Mail, Calendar, and Contacts Graph API Demonstration Senior Software Engineer.

Similar presentations


Presentation on theme: "Redmond Protocols Plugfest 2016 Andrew Davidoff Mail, Calendar, and Contacts Graph API Demonstration Senior Software Engineer."— Presentation transcript:

1 Redmond Protocols Plugfest 2016 Andrew Davidoff Mail, Calendar, and Contacts Graph API Demonstration Senior Software Engineer

2 Agenda Office 365 Graph APIs: endpoints, authentication and URLs Sample Meeting Manager application API calls for Meetings, Contacts and Email Demonstration of API usage with Meeting Manager application Resources

3 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: https://graph.microsoft.com/{version}/{resource}?[odata_query_parameters]

4 What’s in URL? https://graph.microsoft.com/{version}/{resource}?[odata_query_parameter 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 http://graph.microsoft.io/GraphDocuments/en-us/overview/overview.htm

5 Sample Meeting Manager Application Available on GitHub https://github.com/OfficeDev/Interop-REST-Mail-Contacts-Calendar- 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

6 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 https://graph.microsoft.com/v1.0/Me/calendarView?startDateTime={ }&endDateTime={}$orderby=start/dateTime https://graph.microsoft.com/v1.0/Me/calendarView?startDateTime={ }&endDateTime={}$orderby=start/dateTime Get description of event instance or of event series GET https://graph.microsoft.com/v1.0/Me/events/{event_id}https://graph.microsoft.com/v1.0/Me/events/{event_id} Accept/decline event invitation POST https://graph.microsoft.com/v1.0/Me/events/{event_id}/accepthttps://graph.microsoft.com/v1.0/Me/events/{event_id}/accept Body={…}

7 Sample API Calls for Address Book and Contacts Query users from address book GET https://graph.microsoft.com/v1.0/users?$top=10https://graph.microsoft.com/v1.0/users?$top=10 GET https://graph.microsoft.com/v1.0/users?$top=10&$filter=startswith(g ivenName,'a') https://graph.microsoft.com/v1.0/users?$top=10&$filter=startswith(g ivenName,'a') Query number of Contacts GET https://graph.microsoft.com/v1.0/Me/contacts/$counthttps://graph.microsoft.com/v1.0/Me/contacts/$count Query first ten contacts GET https://graph.microsoft.com/v1.0/Me/contacts?$top=10&$skip=0&$o rderby=DisplayName https://graph.microsoft.com/v1.0/Me/contacts?$top=10&$skip=0&$o rderby=DisplayName Get user photo GET https://graph.microsoft.com/v1.0/Me/contacts/{contact_id}/photo/$va lue https://graph.microsoft.com/v1.0/Me/contacts/{contact_id}/photo/$va lue

8 Some API Calls for Email 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 https://graph.microsoft.com/v1.0/Me/MailFolders/Inbox/messages?$filter= Subject eq '{subject}' and CreatedDateTime gt {event_created_datetime} https://graph.microsoft.com/v1.0/Me/MailFolders/Inbox/messages?$filter= 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 https://graph.microsoft.com/v1.0/Me/messages/{message_id}/createreply https://graph.microsoft.com/v1.0/Me/messages/{message_id}/createreply After user clicks Send on Email page, the app updates created message: PATCH https://graph.microsoft.com/v1.0/Me/messages/{message_id}https://graph.microsoft.com/v1.0/Me/messages/{message_id} Body = {…} … and then sends it: POST https://graph.microsoft.com/v1.0/Me/messages/{message_id}/sendhttps://graph.microsoft.com/v1.0/Me/messages/{message_id}/send

9 Demonstration: Meeting Manager

10 Resources Starting points for Office 365 app development: http://dev.office.com http://graph.microsoft.io Summary of common requests available in the Overview http://graph.microsoft.io/GraphDocuments/en-us/overview/overview.htm Sample Meeting Manager application: https://github.com/OfficeDev/Interop-REST-Mail-Contacts-Calendar- Sample Read README.md for important details and registration steps

11 Redmond Protocols Plugfest 2016 Questions or Comments?

12 Redmond Protocols Plugfest 2016 Thank You!


Download ppt "Redmond Protocols Plugfest 2016 Andrew Davidoff Mail, Calendar, and Contacts Graph API Demonstration Senior Software Engineer."

Similar presentations


Ads by Google