February 23rd, 2021

Microsoft Graph Mailbag – Intro to Microsoft Graph and Top 5 API Requests

In today’s Microsoft Graph Mailbag post we will dive into a quick introduction on what Microsoft Graph is and what are the 5 most interesting APIs you should try today.

Please be sure to follow this blog series using https://aka.ms/MSGraphMailbag or with RSS using https://developer.microsoft.com/graph/blogs/feed/?tag=MSGraphMailbag.

Introduction to Microsoft Graph

By now Microsoft Graph has become a very popular name in the world of Microsoft 365 development. If you have not heard about it yet, then you are in the right article.

Microsoft Graph is the API to connect your apps to your Microsoft 365 data and services. There are thousands of data sets that power  our own first party experiences. Even better, we have extended it to the developer community through this unified API layer.

In short, it is the culmination of all the data you have in in Microsoft 365, Windows 10, and Enterprise Mobility + Security all readily available to be accessed and used in your application by consuming its unified programmability model.

Why should you care about integrating Microsoft Graph into your application?

Microsoft Graph is the data and insights that describe the patterns of productivity in an organization, accessed through a unified API endpoint. Use Microsoft Graph to build experiences around the user’s unique context to help them be more productive.

The success of any application is often dependent on the algorithm that decides what should be suggested to the user next in order to make their experience truly seamless.

The more the application makes decisions and actions upon these decisions for the user, the more they get their daily work done. These algorithms can be developed using the insights provided by Graph, and the best part is the most tedious job of identifying the patterns of a user, from the data that resides in Microsoft 365 platform is already done by Graph.

Microsoft Graph powers Microsoft products

If you have been using any Microsoft 365 products in your day-to-day life, then you have been using Microsoft Graph.

How?

Take Outlook for example.  How does Outlook knows who to show in the list of recommended contacts? It is certainly not ordered alphabetically but based on who you collaborate often. That is a Microsoft Graph call happening behind the scenes using data insights to understand who your active collaborators are. And not only does it work across Outlook on your desktop (in the client) but also in the Outlook mobile app running on any device, in Teams, in documents like Word, Excel etc.

Top 5 Microsoft Graph requests to try out today

Here are 5 of my favorite Graph API requests you can try out and use in the apps you are developing.

  1. Get user profile information– Get profile information of the currently logged in user or another user.

GET /me

GET /users/{id | userPrincipalName}

  1. Get user photo – Get photo of the currently logged in user or another user or group

GET /me/photo/$value

GET /users/{id | userPrincipalName}/photo/$value

  1. Get my recent files – Get files recently used but the currently logged in user be it from the user’s drive as well as items the have access to from other drives

GET /me/drive/recent

  1. Get presence of a user/users – Get presence of a user

GET /me/presence

GET /users/{id}/presence

GET /communications/presences

  1. Send notification to a user in Teams – Send an activity feed notification in the scope of a team

POST /teams/{teamId}/sendActivityNotification

How can you try these requests out?

You can use Microsoft Graph Explorer which is a web-based tool that you can use to build and test requests using Microsoft Graph APIs. Postman is another tool that you can also use to build and test requests using the Microsoft Graph APIs.

You can use Graph Explorer to query the provided sandbox tenant (unauthenticated) or you can sign up for a Microsoft 365 Developer tenant where you have an account with global tenant admin privileges, 25 total users, and sample data.

Want to get started on developing application using Microsoft Graph?

Head to the tutorials and choose what programming language or framework you are familiar with and start creating something. If you noticed already, Graph is cross-platform because it lives in the cloud and do not bind itself to a device or an operating system.

Looking for existing applications which did a fantastic job integrating Microsoft Graph?

You can also go to Microsoft AppSource – destination for business apps and filter productivity and collaboration apps to find many apps which are frequently connected to the Graph and highlight a wide variety of ways to integrate with the Microsoft 365 platform. This will help you understand the scenarios better and even unlock a great potential in enhancing an existing application you have or to build one on your own.

What do you think about Microsoft Graph and the documentation so far? And how should we improve it further? Please let us know!

 

Today’s post was written by Rabia Williams, Cloud Developer Advocate at Microsoft.  You can follow Rabia on Twitter @williamsrabia.  Join us for our next Microsoft Graph Mailbag post March 9, 2021.