Forum Discussion
admin-CPH
May 31, 2022Brass Contributor
Microsoft Graph API filter
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"
}
}
}
- 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- admin-CPHBrass Contributor
Did you set the header value?