question

AngelaWillingham-8632 avatar image
0 Votes"
AngelaWillingham-8632 asked DanKershaw-5643 answered

Query if a user is in any of multiple given groups - Microsoft Graph Explorer

I am trying to come up with a query using Microsoft Graph Explorer that will check if the logged in user is part of any of the named security groups. Just for clarification I want to know if they are part of any of the ones listed and which ones from that list. The query below works for finding out if they are in one but I cant figure out how to add 'or' to add multiple options. Any help would be appreciated.

https://graph.microsoft.com/v1.0/me/memberOf?$filter=id eq 'insert group ID here'

microsoft-graph-users
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

DanKershaw-5643 avatar image
0 Votes"
DanKershaw-5643 answered

Try using checkMemberGroup. See https://docs.microsoft.com/en-us/graph/api/directoryobject-checkmembergroups?view=graph-rest-1.0&tabs=http for details and examples.

The other way you can do this is using advanced query capabilities (https://docs.microsoft.com/en-us/graph/aad-advanced-queries?context=graph%2Fapi%2F1.0&view=graph-rest-1.0):

GET https://graph.microsoft.com/v1.0/me/memberOf?$filter=id in ('{id1}','{id2}','{id3}')&$count=true
ConsistencyLevel: eventual

NOTE the HTTP header...

Hope this helps,
Dan

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.