wkaczurba

Microsoft Graph

Intro

Calling/Querying a REST API method:

TODO: Paste results

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

GET/POST/PATCH/PUT/DELETE version: 1.0 or beta.

Querying

Query parameters can be OData system query options

GET https://graph.microsoft.com/v1.0/me/messages?filter=emailAddress eq 'jon@contoso.com'

See also:

Example on how to update user - Using Graph API.

Querying Microsoft Graph using SDKs from tutorial

NuGet packages - which ones.

var graphClient = new GraphServiceClient(deviceCodeCredential, scopes);

Where:


// https://learn.microsoft.com/dotnet/api/azure.identity.devicecodecredential
var deviceCodeCredential = new DeviceCodeCredential(
    callback, tenantId, clientId, options);

Getting info about self (https://graph.microsoft.com/v1.0/me):

var user = await graphClient.Me.Request().GetAsync();

Retrieve a list of entities Delete an entity

Create a new entity

var calendar = new Calendar
{
    Name = "Volunteer"
};

var newCalendar = await graphClient.Me.Calendars
    .Request()
    .AddAsync(calendar);

Best practices

Access using either bearer token or graph client constgructor (for libs)

Practices: