Last active
January 16, 2024 19:35
-
-
Save maisarissi/50d075d2d44a114eb4420f298ff50ceb to your computer and use it in GitHub Desktop.
microsoftgraph-java-v6-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 | |
//graph.microsoft.com/v1.0/groups/{group-id}/members/microsoft.graph.user | |
UserCollectionResponse usersInGroup = graphClient | |
.groups() | |
.byGroupId("group-id") | |
.members() | |
.graphUser() | |
.get(); | |
List<User> users = usersInGroup.getValue(); | |
//Similarly, members of the group of type ServicePrincipal | |
//graph.microsoft.com/v1.0/groups/{group-id}/members/microsoft.graph.servicePrincipal | |
ServicePrincipalCollectionResponse servicePrincipalsInGroup = graphClient | |
.groups() | |
.byGroupId("group-id") | |
.members() | |
.graphServicePrincipal() | |
.get(); | |
List<ServicePrincipal> servicePrincipals = servicePrincipalsInGroup.getValue(); |
Hi @MohamedSalahSayed . I'm using the Release Candidate (RC) version of the new Microsoft Graph Java v6 version. You can find more info here: https://devblogs.microsoft.com/microsoft365dev/write-simpler-faster-code-with-the-new-microsoft-graph-java-sdk-v6/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I am getting errors when using
.members().graphUser()
the graphUser() is not available in the return value of members().
Can you please show us the dependencies you used?
thanks