Last active
December 7, 2023 19:42
-
-
Save maisarissi/f9a6825cd51abc5128049af1b4a805fb to your computer and use it in GitHub Desktop.
msgraph-dotnet-v5-ga-odata-cast
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Fetching the members of a group who are of the type User | |
var usersInGroup = await graphServiceClient | |
.Groups["group-id"] | |
.Members | |
.GraphUser //cast to User | |
.GetAsync(); | |
List<User> userList = usersInGroup.Value; | |
//Similarly, members of the group of type ServicePrincipal | |
var servicePrincipalsInGroup = await graphServiceClient | |
.Groups["group-id"] | |
.Members | |
.GraphServicePrincipal //cast to ServicePrincipal | |
.GetAsync(); | |
List<ServicePrincipal> servicePrincipalList = servicePrincipalsInGroup.Value; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment