Microsoft Graph

Explore Microsoft 365

Graph Explorer

Microsoft Graph is a REST API that can be used to access: Microsoft 365, Azure Active Directory, Windows and Dynamics 365.

Graph Explorer is a developer tool that allows a developer to make Microsoft Graph REST API requests and view corresponding responses.

Here I am using the Graph Explorer without signing in to my Active Directory account (using a sample account)

Here I am entering my password

I am required to approve the sign in request using my mobile phone (two factor authentication)

I can retrieve my profile details using a "/me/" request. GET my profile - https://graph.microsoft.com/v1.0/me/

Graph Explorer permissions

Before the Graph Explorer is able to retrieve email messages using Microsoft Graph the user (or an administrator) has to provide consent. The user is agreeing that the client application (Graph Explorer in this case) can access parts of the Microsoft Graph on their behalf.

access denied - https://graph.microsoft.com/v1.0/me/messages

Here the administrator grants this application (Graph Explorer) permission to access a user's email messages (on that user's behalf).

GET my mail - https://graph.microsoft.com/v1.0/me/messages

A second consent is needed to allow this application (Graph Explorer) to access a user's One drive and SharePoint online files (on that user's behalf) - https://graph.microsoft.com/v1.0/me/drive/root/children

Here the administrator grants this application (Graph Explorer) permission to access the user's (One drive and SharePoint online) files

GET all the items in my (one) drive (root folder) - https://graph.microsoft.com/v1.0/me/drive/root/children

At this time there were no files in my one drive's root folder

Teams/SharePoint Online/One Drive files

Microsoft Teams channels include a "Files" tab.

Files uploaded to the Team's channel are stored in SharePoint Online.

All files uploaded to all public channels are stored in a shared Document Library in a Team specific SharePoint Online Site (Site Collection).

This SharePoint online Document Library can also be accessed using the One Drive application.

The Mark 8 Project Team's Team includes a General and a Design channel.

The Design channel's files can be accessed without leaving the Teams application. The Design channel's files can also be accessed using the SharePoint user interface (using the "Open in SharePoint" menu item)

In the SharePoint user interface it is clear that the Design channel's files are stored a the "Design" Folder in the shared "Documents" Document Library in the "Mark 8 Project Team" SharePoint site

The "Documents" Document Library in the "Mark 8 Project Team" site can also be accessed using the One Drive user interface.

The One Drive user interface can be used to show that there is a second "Confidential" Document Library in the "Mark 8 Project Team" Site.

Using Microsoft Graph to access Teams/SharePoint Online/One Drive files

Graph explorer can be used to access Teams/SharePoint Online/One Drive files

GET SharePoint site based on relative path to (the "Mark8Project") site - https://graph.microsoft.com/v1.0/sites/{host-name}:/{server-relative-path} - https://graph.microsoft.com/v1.0/sites/p8lf.sharepoint.com:/sites/Mark8ProjectTeam

GET enumerate the document libraries under the (the "Mark8Project") site - https://graph.microsoft.com/v1.0/sites/{siteid}/drives
- https://graph.microsoft.com/v1.0/sites/p8lf.sharepoint.com,93621faf-8562-41e0-ac8c-13117ad3494a,c62f05b5-b3b9-45af-9935-0d5adca1a908/drives

GET all the items in specified drive - https://graph.microsoft.com/v1.0/drives/{driveid}/root/children -https://graph.microsoft.com/v1.0/drives/b!rx9ik2KF4EGsjBMRetNJSrUFL8a5s69FmTUNWtyhqQioATjXxIu7Q6WHB3PuAtBi/root/children

GET all the items in specified folder in the specified drive
- https://graph.microsoft.com/v1.0/drives/{driveid}/items/{folderid}/children
https://graph.microsoft.com/v1.0/drives/b!rx9ik2KF4EGsjBMRetNJSrUFL8a5s69FmTUNWtyhqQioATjXxIu7Q6WHB3PuAtBi/items/0165QRNMIDD63SJ6RBTFHZY2G4LDYN6K7M/children

Items trending around me

M365 is able to keep track of documents a user has recently accessed.

recently accessed

Items trending

Items trending around me can also be accessed using Microsoft Graph.

GET items trending around me - https://graph.microsoft.com/beta/me/insights/trending

Code snippets

Graph Explorer is also able to provide sample JavaScript code that could be used to access Microsoft Graph

Sample JavaScipt code