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 article helpful? Looking to deploy a new, easy-to-manage, and cost-effective hyperconverged infrastructure?
Alex Bykovskyi
Alex Bykovskyi StarWind Virtual HCI Appliance Product Manager
Well, we can help you with this one! Building a new hyperconverged environment is a breeze with StarWind Virtual HCI Appliance (VHCA). It’s a complete hyperconverged infrastructure solution that combines hypervisor (vSphere, Hyper-V, Proxmox, or our custom version of KVM), software-defined storage (StarWind VSAN), and streamlined management tools. Interested in diving deeper into VHCA’s capabilities and features? Book your StarWind Virtual HCI Appliance demo today!