Advanced query capabilities not working in Microsoft Graph API

Roger Schmidt 16 Reputation points
2021-09-01T09:51:11.413+00:00

Hello

Following this documentation:
https://learn.microsoft.com/en-us/graph/aad-advanced-queries

However, the examples don't work in Graph API Explorer. When trying you always get response with error code "Request_UnsupportedQuery".

Example:

GET https://graph.microsoft.com/v1.0/users?$filter=accountEnabled ne true&$count=true  
ConsistencyLevel: eventual  
  
{  
   "error": {  
      "code": "Request_UnsupportedQuery",  
      "message": "Unsupported property filter clause operator 'NotEqualsMatch'.",  
      "innerError": {  
      "date": "2021-09-01T08:49:09",  
      "request-id": "42eae13b-0c60-4d1f-bd07-dced22f788d3",  
      "client-request-id": "42eae13b-0c60-4d1f-bd07-dced22f788d3"  
   }  
}  

Thanks,
Roger

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,056 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Danstan Onyango 3,816 Reputation points Microsoft Employee
    2021-09-02T10:18:07.093+00:00

    You are right. "Unsupported property filter clause operator 'NotEqualsMatch'." happens when you call MS Graph users without a signed in user on Graph Explorer. GET https://graph.microsoft.com/v1.0/users?$filter=accountEnabled ne true&$count=true with Header ConsistencyLevel: eventual should work with signed users and right permissions.

    However, the query operators are not fully supported on all resource properties. As for endsWith(DisplayName,'vasil') this does not work because as per Advanced query capabilities on Azure AD directory objects support for filters, quoting:

    The endsWith operator is supported only with advanced queries on mail and userPrincipalName properties.

    1 person found this answer helpful.
    0 comments No comments

  2. Mirna Jammoul [Entelligence] 0 Reputation points
    2024-04-15T13:22:46.67+00:00

    To resolve the issue, you can include the ConsistencyLevel: eventual attribute in the header of your request. This attribute ensures that your query is executed with eventual consistency, which can be particularly helpful in cases where the data might not be immediately consistent across all replicas.

    In .NET, you can achieve this by creating an HttpRequestMessage object and adding the ConsistencyLevel header before sending the request. Here's an example:

    csharpCopy code
    HttpRequestMessage request = 
    

    By including this header attribute, you can potentially mitigate errors related to unsupported filter operators, as it ensures a consistent behavior in retrieving data from the Microsoft Graph API.

    0 comments No comments