Skip to content

Instantly share code, notes, and snippets.

@maisarissi
Last active February 23, 2023 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maisarissi/92b6e6afcc821de6581d883403e7f470 to your computer and use it in GitHub Desktop.
Save maisarissi/92b6e6afcc821de6581d883403e7f470 to your computer and use it in GitHub Desktop.
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
var servicePrincipalsInGroup = await graphServiceClient
    .Groups["group-id"]
    .Members
    .MicrosoftGraphServicePrincipal
    .GetAsync();
List<ServicePrincipal> servicePrincipalList = servicePrincipalsInGroup.Value;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment