Skip to content

Instantly share code, notes, and snippets.

View maisarissi's full-sized avatar

Maísa Rissi maisarissi

  • São Paulo, Brazil
  • 12:10 (UTC -03:00)
View GitHub Profile
@maisarissi
maisarissi / RequestConfiguration.cs
Last active February 8, 2023 20:26
msgraph-dotnet-v5-rc-request-configuration
var user = await graphServiceClient
.Users["{user-id}"]
.GetAsync(requestConfiguration =>
{
requestConfiguration.Headers.Add("ConsistencyLevel","eventual");
requestConfiguration.QueryParameters.Select = new string[] { "id", "createdDateTime"};
});
@maisarissi
maisarissi / ODataCast.cs
Last active February 23, 2023 14:04
msgraph-dotnet-v5-rc-odata-cast
//Fetching the members of a group who are of the type User
var usersInGroup = await graphServiceClient
    .Groups["group-id"]
    .Members
    .MicrosoftGraphUser
    .GetAsync();
List<User> userList = usersInGroup.Value;
//Similarly, members of the group of type ServicePrincipal
@maisarissi
maisarissi / CreateBothClients.cs
Last active February 9, 2023 13:21
msgraph-dotnet-v5-rc-v1-beta-clients
InteractiveBrowserCredential interactiveBrowserCredential = new ("ClientID");
//create client for calling v1 endpoint and get my info
Microsoft.Graph.GraphServiceClient graphServiceClient = new (tokenCredential, scopes);
var userFromV1 = await graphServiceClient.Me.GetAsync();
//create client for calling beta endpoint and get my info
Microsoft.Graph.Beta.GraphServiceClient betaGraphServiceClient = new(tokenCredential, scopes);
var userFromBeta = await betaGraphServiceClient.Me.GetAsync();