Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

Getting Started with Microsoft Graph Explorer

  • December 24, 2019
  • 8 min read
IT Production Manager. Nicolas is primarily focused on Microsoft technologies, he is a Microsoft MVP in Cloud and Datacenter Management.
IT Production Manager. Nicolas is primarily focused on Microsoft technologies, he is a Microsoft MVP in Cloud and Datacenter Management.

 Microsoft Graph

What is Microsoft Graph?

Microsoft Graph exposes REST APIs and client libraries to access data on the following Microsoft 365 services:

  • Office 365 services: Delve, Excel, Microsoft Bookings, Microsoft Teams, OneDrive, OneNote, Outlook/Exchange, Planner, and SharePoint
  • Enterprise Mobility and Security services: Advanced Threat Analytics, Advanced Threat Protection, Azure Active Directory, Identity Manager, and Intune
  • Windows 10 services: activities, devices, notifications
  • Dynamics 365 Business Central

What Is Microsoft Graph Explorer?

Microsoft Graph Explorer is a web-based tool that helps you build and test queries in order to interact with Microsoft resources. So, in this post, I will use it to manage data. You can access to Microsoft Graph Explorer from this link: https://developer.microsoft.com/en-us/graph/graph-explorer#

Microsoft Graph Explorer

The first thing you need to do is to sign in with your account in order to access your own data. If you use Graph Explorer without your account, you will use the demo data. So click “Sign in with Microsoft”.

Sign in with Microsoft

The following part allows you to interact with your Microsoft resources. It can be divided in three parts:

Run Query

First, you can choose the action you want to perform:

Choose the action you want to perform

  • GET: Read data from a resource.
  • POST: Create a new resource or perform an action.
  • PUT: Replace a resource with a new one.
  • PATCH: Update a resource with new values.
  • DELETE: Remove a resource.

Next, you can select the API version you want to use:

Select the API version

  • V1.0 : Includes generally APIs. You can use this version for all production apps.
  • Beta : Includes APIs that are currently in preview. Microsoft recommends to not use beta APIs in production.

Then, there is the resource field which always starts with: https://graph.microsoft.com. This field allows you to insert the resource you want to manage. Below is the link that will be used:

  • Graph link + API version + Resource link

For instance, the full resource link could be:

https://graph.microsoft.com/v1.0/me/drive/recent

The following textbox allows you to enter the new value to create or the date you want to update.

Textbox allows you to enter the new value

The following textbox will display data or error messages:

Textbox will display data or error message

Let’s start by running the following query to display your information:

https://graph.microsoft.com/v1.0/me/

Graph Explorer

You can use sample queries on the left side by clicking “show more samples”, then turn on/turn off the sample categories you want to use:

Sample queries

Sometimes you can see the following error message:

Error message

This error means that you need specific permissions in order to use this query. Let’s see how to manage these permissions.

The first step is to check the documentation page https://docs.microsoft.com/en-us/graph to identify the permissions you have to allow. In my case, I want to read my OneNote notebooks:

Permissions

The second step is to click “modify your permissions” in the error message in order to enable the permissions:

Modify permissions

After applying the permissions, you need to log in again to refresh the permissions in Graph Explorer. Run the query to confirm that you can access your OneNote notebooks:

OneNote notebooks

Copy the OneNote Notebook ID in order to create a new section:

  1. Select the POST action, because we want to create a resource
  2. Paste the following link: https://graph.microsoft.com/v1.0/me/onenote/notebooks/<ID>/sections and modify the ID
  3. Enter the name of the new section that will be created in the “Request Body” textbox.

Request Body

Let’s check my OneNote and confirm that a new section named “Section from MS graph Explorer” is visible:

Section from MS graph Explorer

Conclusion

Thanks to the Graph API, we can very easily interact with the Microsoft resources. In this guide, I worked with OneNote, but a useful use case could be to interact with Microsoft Teams in order to create a new Teams/Channel, to add a member, and so on …

To finish, you can of course interact with the Graph API from your code as described on the following picture:

 Graph API

Hey! Found Nicolas’s insights useful? Looking for a cost-effective, high-performance, and easy-to-use hyperconverged platform?
Taras Shved
Taras Shved StarWind HCI Appliance Product Manager
Look no further! StarWind HCI Appliance (HCA) is a plug-and-play solution that combines compute, storage, networking, and virtualization software into a single easy-to-use hyperconverged platform. It's designed to significantly trim your IT costs and save valuable time. Interested in learning more? Book your StarWind HCA demo now to see it in action!