SOLVED

Microsoft Graph API filter

%3CLINGO-SUB%20id%3D%22lingo-sub-3451935%22%20slang%3D%22en-US%22%3EMicrosoft%20Graph%20API%20filter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3451935%22%20slang%3D%22en-US%22%3E%3CP%3EI%20use%26nbsp%3B%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%24filter%3CSPAN%3E%26nbsp%3Bquery%20parameter%20to%20retrieve%20the%20users%20in%26nbsp%3B%20Department%20'external'%20as%20%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%3F%24filter%3DDepartment%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%3F%24filter%3DDepartment%3C%2FA%3E%20eq%20'external'%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Ebut%20when%20I%20want%20to%20retrieve%20all%20the%20users%20in%20all%20Department%20except%20'external'%20as%20%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%3F%24filter%3DDepartment%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%3F%24filter%3DDepartment%3C%2FA%3E%20ne%20'external'%20.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20got%20the%20error%20below%20%3A%3C%2FSPAN%3E%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3E%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3E%22error%22%3C%2FSPAN%3E%3CSPAN%3E%3A%20%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3E%22code%22%3C%2FSPAN%3E%3CSPAN%3E%3A%20%3C%2FSPAN%3E%3CSPAN%3E%22Request_UnsupportedQuery%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3E%22message%22%3C%2FSPAN%3E%3CSPAN%3E%3A%20%3C%2FSPAN%3E%3CSPAN%3E%22Unsupported%20property%20filter%20clause%20operator%20'NotEqualsMatch'.%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3E%22innerError%22%3C%2FSPAN%3E%3CSPAN%3E%3A%20%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3E%22date%22%3C%2FSPAN%3E%3CSPAN%3E%3A%20%3C%2FSPAN%3E%3CSPAN%3E%222022-05-31T19%3A42%3A21%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3E%22request-id%22%3C%2FSPAN%3E%3CSPAN%3E%3A%20%3C%2FSPAN%3E%3CSPAN%3E%22c1132cf4-d5f7-44b5-90dd-c8404f7cc9e9%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3E%22client-request-id%22%3C%2FSPAN%3E%3CSPAN%3E%3A%20%3C%2FSPAN%3E%3CSPAN%3E%22167a524c-ac57-5dcb-d0f3-ef1db5eff8f2%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3451935%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAPI%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3453974%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Graph%20API%20filter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3453974%22%20slang%3D%22en-US%22%3EUsing%20%22ne%22%20constitutes%20an%20%22advanced%20query%22%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Faad-advanced-queries%3Ftabs%3Dhttp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Faad-advanced-queries%3Ftabs%3Dhttp%3C%2FA%3E%3CBR%20%2F%3ESo%20you%20need%20to%20use%20the%20ConsistencyLevel%3Deventual%20header%20and%20%24count%3Dtrue%20operator%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fusers%3F%24filter%3DDepartment%2Bne%2B'external'%26amp%3B%24count%3Dtrue%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fusers%3F%24filter%3DDepartment%2Bne%2B'external'%26amp%3B%24count%3Dtrue%3C%2FA%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3454032%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Graph%20API%20filter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3454032%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3CBR%20%2F%3EI%20got%20the%20same%20error.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58%22%20target%3D%22_blank%22%3E%40Vasil%20Michev%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3456135%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Graph%20API%20filter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3456135%22%20slang%3D%22en-US%22%3E%3CP%3EDid%20you%20set%20the%20header%20value%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VasilMichev_0-1654098783229.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VasilMichev_0-1654098783229.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22VasilMichev_0-1654098783229.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F376816iAB6839373857F0A2%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22VasilMichev_0-1654098783229.png%22%20alt%3D%22VasilMichev_0-1654098783229.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3458919%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Graph%20API%20filter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3458919%22%20slang%3D%22en-US%22%3ETHanks%20a%20lot%3CBR%20%2F%3Eit%20is%20working%3C%2FLINGO-BODY%3E
Occasional 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"
        }
    }
}

 

 

4 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 

best response confirmed by saf-cop (Occasional Contributor)
Solution

Did you set the header value?

 

VasilMichev_0-1654098783229.png

 

THanks a lot
it is working