Got it:
$filter=startsWith(displayName,'MYPREFIX-WHATEVS')&$select=displayName&$expand=members($select=id,userPrincipalName,displayName)
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Is there a way to get a list of AAD groups with membership count? With Graph API? Even if ConsistencyLevel=Eventual?
Like: /groups?$filter=startsWith(displayName,'MYPREFIX-WHATEVS')&$select=displayName,members/$count
Got it:
$filter=startsWith(displayName,'MYPREFIX-WHATEVS')&$select=displayName&$expand=members($select=id,userPrincipalName,displayName)
Hi dear @Brian McCullough
There is something wrong with your API, because members
is actually an expansion item and not a child item, so your API should be changed to: /groups?$filter=startsWith(displayName,'MYPREFIX-WHATEVS')&$select=displayName&$expand=members
.
Since the expansion parameter $expand
and the count parameter $count
cannot be used together, your original API should remove the members
parameter:
GET https://graph.microsoft.com/beta/groups?$filter=startsWith(displayName,'MYPREFIX-WHATEVS')&$select=displayName,id&$count=true
ConsistencyLevel: eventual
Or only count the number of members of a certain group:
https://graph.microsoft.com/beta/groups/{group object id}/members?$filter=startsWith(displayName,'MYPREFIX-WHATEVS')&$select=displayName,id&$count=true
ConsistencyLevel: eventual
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.