Does Microsoft Java Graph SDK provide listing all users and subgroups inside a group?

Shubham Arora 1 Reputation point


I had use cases where I wanted to list users and sub-groups inside a group.
I have seen that we can only create Security group inside a security group. So, I can understand that we can list only security group
inside security group.

I can see that members() in SDK would list all the members in a group and memberof() will list the parent group when we specify the id of inner group.

Does Microsoft Graph SDK support listing only users in a group and listing only sub-group in a group differently.

Please let me know this as soon as possible.


Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,535 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Shubham Arora 1 Reputation point

    Hi SaurabhSharma,

    I am able to list members() of a group in Java SDK.
    But I am trying to list sub-group and user in a group separately.

    I can differentiate users and sub-groups inside a group by @odata.type property.
    For group, it would be "@odata.type": "",
    For user, it would be "@odata.type": "#microsoft.graph.user"

    I tried to filter by this property but I think it is an limitation from Graph API that we cannot filter using @odata.type property.
    Can you please help me with how I can differentiate the members in a group by @odata.type property.

    0 comments No comments

  2. Saurabh Sharma 23,791 Reputation points Microsoft Employee

    @ShubhamArora-0040 - You can append the members REST endpoint with "" to get all the subgroups in a Group. e.g.\<group id>/members/

    However, I do see any way to do that through Graph SDK. I will be checking though internally with the products team if there is any way to filter only sub-groups. I will update here once I get a response but it may take couple of days.

    (Please don't forget to accept helpful replies as answer)

  3. Saurabh Sharma 23,791 Reputation points Microsoft Employee

    @Shubham Arora I have received confirmation from product team that the filter query is not supported for this endpoint for any properties. Please provide your feedback in UserVoice so that community can upvote and the products team can plan to include in their future releases.

    0 comments No comments