Office 365 – Microsoft Graph and Graph Explorer

Hi All,

Recently I got a chance to work on Office 365 groups. Requirement is I need to list all groups to those I belong to (current user groups). So here Microsoft Graph comes to picture. Here I’ll discuss Microsoft Graph, Microsoft Graph APIs, Graph Explorer.

What is Microsoft Graph?

Microsoft Graph provides APIs for developers to access data across Microsoft cloud.

Its built on the top of Office 365. Previously Microsoft Graph is known as Office 365 unified API.

Microsoft Graph exposes APIs, data across Office 365 and Azure AD. We can query to Users, Groups, Mail, Calendars, OneDrive, Azure Active Directory, OneNote, Planner, and so on.

Microsoft Graph exposes RESTFul services.

It provide single endpoint : https://graph.microsoft.com to communicate with different Office 365 cloud services like SharePoint Online, Planner, Yammer, Office 365 Groups, Office 365 Users etc.

Currently Microsoft Graph API v1.0 is stable version available and beta also available.

For details what we can do with Microsoft Graph  please have a look at examples given- https://developer.microsoft.com/en-us/graph/examples

To read or write cloud service resource such as User, Email, Office 365 Group and so on we need to create the request as

https://graph.microsoft.com/{version}/{resource}?query-parameters where

{version}: Graph API version. Current version is 1.0.

{resource}: Like User, Email, Office 365 Group and so on.

query-parameters: Optional parameter to filter the response. For more details on query-parameters please have a look once https://developer.microsoft.com/en-us/graph/docs/concepts/query_parameters

What is Microsoft Graph Explorer?

Microsoft Graph Explorer is a tool to test the Microsoft Graph Queries. We can access Microsoft Graph Explorer with URL – https://developer.microsoft.com/en-us/graph/graph-explorer .

We need to sign in with our Office 365 account to test our queries. By default, it uses sample account. We need to sign in with Microsoft account from option available at left side as

 

fig 1 Graph Explorer
Figure 1: Office 365 – Graph Explorer – “Sign in with Microsoft”

Once we are signed, we are ready to execute the queries.

This tool contains many sample queries to start as

fig 2 Graph Explorer sample queries
Figure 2: Office 365 – Graph Explorer – Sample Queries

This tool also contains the history of our queries which we executed as

fig 3 Graph Explorer query history
Figure 3: Office 365 – Graph Explorer – History of our queries

Executing the queries: Once we have authenticated with our Office 365 credentials, we are ready to execute the queries as

fig4 Queries in Graph Explorer
Figure 4: Office 365 – Graph Explorer – Executing queries

Here, /me/ is alias for current user. So, in response we will get details of current user as

fig5 query response
Figure 5 : Office 365 – Graph Explorer – Query response

We could also set the permissions like against which Office 365 services we can execute queries as

fig6graphapipermissions
Figure 6: Office 365 – Graph Explorer – “modifying permissions” link to update the permissions

As we click on “modify permissions” link, “Modify Permissions” dialog appears as

fig7modifypermissions
Figure 7: Office 365 – Graph Explorer – Modify Permissions dialog

There are many more options to explore here, Now I’ll stop here. I would say explore Graph Explorer, this is very handy tool.

References:

https://developer.microsoft.com/en-us/graph

https://developer.microsoft.com/en-us/graph/docs/concepts/overview

https://www.sharepointeurope.com/introduction-microsoft-graph-development-part-1/

https://developer.microsoft.com/en-us/graph/docs/concepts/permissions_reference

Thanks for reading 🙂

Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more. If you have any suggestion / feedback / doubt, you are most welcome.

Stay tuned on Knowledge-Junction, will come up with more such articles / news.

Advertisements

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.