Microsoft Graph API filter

Brass Contributor

I use  $filter query parameter to retrieve the users in  Department 'external' as :

https://graph.microsoft.com/v1.0/users?$filter=Department eq 'external'

 

but when I want to retrieve all the users in all Department except 'external' as :

https://graph.microsoft.com/v1.0/users?$filter=Department ne 'external' .

I got the error below :

{
    "error": {
        "code": "Request_UnsupportedQuery",
        "message": "Unsupported property filter clause operator 'NotEqualsMatch'.",
        "innerError": {
            "date": "2022-05-31T19:42:21",
            "request-id": "c1132cf4-d5f7-44b5-90dd-c8404f7cc9e9",
            "client-request-id": "167a524c-ac57-5dcb-d0f3-ef1db5eff8f2"
        }
    }
}

 

 

5 Replies
Using "ne" constitutes an "advanced query": https://docs.microsoft.com/en-us/graph/aad-advanced-queries?tabs=http
So you need to use the ConsistencyLevel=eventual header and $count=true operator:

https://graph.microsoft.com/beta/users?$filter=Department+ne+'external'&$count=true

Hi
I got the same error.

 

@Vasil Michev 

Did you set the header value?

 

VasilMichev_0-1654098783229.png

 

Hi,

how to use the filter to grab the members of AZ group?

https://graph.microsoft.com/v1.0/users?$filter= group members 

 

 

 

 

@Vasil Michev 

Hey,
I found that the result is not correct :(