mail, calendar, and contacts graph api demonstration file19.04.2016 · mail, calendar, and contacts...

14
Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer

Upload: others

Post on 24-Sep-2019

28 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

Mail, Calendar, and Contacts Graph API Demonstration

Andrew Davidoff

Senior Software Engineer

Page 2: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

Agenda

• Introduction to Office 365 Graph APIs

• Endpoints, authentication and URLs

• Sample Meeting Manager application

• Sample API calls for Meetings, Contacts and Email

• Demonstration of API usage with Meeting Manager application

• Resources

Page 3: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

What is Microsoft Graph

• Microsoft Graph exposes multiple APIs from Microsoft cloud services through a single REST API endpoint.

• Using the Microsoft Graph, you can turn formerly difficult or complex queries into simple navigations.

• The Microsoft Graph gives you:• A unified API endpoint for accessing aggregated data from multiple

Microsoft cloud services in a single response

• Seamless navigation between entities and the relationships among them

• Access to intelligence and insights coming from the Microsoft cloud

• All this using a single authentication token.

Page 4: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

What is accessible through Microsoft Graph

• Entities:• Users, groups

• Mail, messages, calendars, tasks, and notes

• Files and documents

• From multiple services:• Outlook, OneDrive, Azure Active Directory, Planner, OneNote and others

• And more:• Relationships and team work items

Page 5: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

How to use Microsoft Graph APIs

• You 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]

Page 6: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

What’s in URL?

https://graph.microsoft.com/version/resource?[odata_query_parameters]

• 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

Page 7: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

Sample Meeting Manager Application

• Available on GitHub• https://github.com/OfficeDev/Interop-REST-Mail-Contacts-Calendar-

Sample

• Sample code for two platforms: Android and Windows (UWP)

• The sample is a real working application and can be used as starting point or a set of building blocks

• Both applications log requests and responses to let you examine real-life traffic• UWP application has advanced, detailed logging

Page 8: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

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 dateGET https://graph.microsoft.com/v1.0/Me/calendarView?startDateTime=&endDateTime=$orderby=start/dateTime

• Get description of event instance or of event seriesGET https://graph.microsoft.com/v1.0/Me/events/event_id

• Accept/decline event invitationPOST https://graph.microsoft.com/v1.0/Me/events/event_id/accept

Body=…

Page 9: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

Sample API Calls for Address Book and Contacts

• Query users from address bookGET https://graph.microsoft.com/v1.0/users?$top=10

GET https://graph.microsoft.com/v1.0/users?$top=10&$filter=startswith(givenName,'a')

• Query number of ContactsGET https://graph.microsoft.com/v1.0/Me/contacts/$count

• Query first ten contactsGET https://graph.microsoft.com/v1.0/Me/contacts?$top=10&$skip=0&$orderby=DisplayName

• Get user photoGET https://graph.microsoft.com/v1.0/Me/contacts/contact_id/photo/$value

Page 10: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

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

• 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

• After user clicks Send on Email page, the app updates created message:PATCH 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/send

Page 11: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

Demonstration: Meeting Manager

Page 12: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

Resources

• Starting points for 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 details

Page 13: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

Questions or

Comments?

Page 14: Mail, Calendar, and Contacts Graph API Demonstration file19.04.2016 · Mail, Calendar, and Contacts Graph API Demonstration Andrew Davidoff Senior Software Engineer. Agenda •Introduction

Thank You!