we are using the following query to get the list of all the members in a group
https://graph.microsoft.com/v1.0/groups/{id}/members
requirement
couldn't find any information on searching on multiple entities (group and user).
With a single query, you can retrieve users members of a specific group and expand groups where the user is a member of.
GET /v1.0/groups/{group_id}/members/microsoft.graph.user?$expand=memberof/microsoft.graph.group($select=id)
Counting must be done on the client
If you prefer the Microsoft Graph .NET SDK
var result = await graphClient.Groups["{group-id}"].Members.GraphUser.GetAsync((rc) =>
{
rc.QueryParameters.Expand = new string []{ "memberof/microsoft.graph.group($select=id)" };
});
var pageIterator = PageIterator<User, UserCollectionResponse>.CreatePageIterator(graphClient, result, (user) =>
{
var groupCount = user.MemberOf.Count;
return true;
});
await pageIterator.IterateAsync();