Share via

Filter not-equal groupTypes

berlitz 1 Reputation point
2021-05-27T15:21:12.567+00:00

I've seen the example to list all groups where the Type equals Microsoft365('Unified')
https://graph.microsoft.com/v1.0/groups?$filter=groupTypes/any(c:c+eq+'Unified')

Also another page states ne (not equal) is valid. However I didn't find a way to create a query which gets all Groups where the type is not Unified. I feel the documentation doesn't make quite clear how the /any(c:c [...]) works.

I tried (see below) which don't seem to be supported.
https://graph.microsoft.com/v1.0/groups?$filter=groupTypes/any(c:c+ne+'Unified')
https://graph.microsoft.com/v1.0/groups?$filter=groupTypes/all(c:c+ne+'Unified')

Microsoft Security | Microsoft Graph

1 answer

Sort by: Most helpful
  1. Dan Kershaw 416 Reputation points Microsoft Employee
    2021-10-24T10:59:23.297+00:00

    @berlitz sorry for the late response.
    This query is possible using advanced query capabilities - see https://learn.microsoft.com/en-us/graph/aad-advanced-queries. To "activate" advanced queries you'll need to set an additional HTTP header and add $count to the query parameters. Rather than use a "ne" (which is not supported in Lambda functions) or the any() Lambda function (also not yet supported), you can instead try this using the "not" operator:

    GET https://graph.microsoft.com/v1.0/groups?$filter=not groupTypes/any(c:c+eq+'Unified')&$count=true
    ConsistencyLevel: eventual

    Hope this helps
    Dan

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.