Not equal filter is not working when applying in api call

Pokemon Go 0 Reputation points
2023-05-10T17:35:01.0833333+00:00

I am trying to get a list of users where mail is not equal to null but it comes with request_unsupportedquery, message :filter operator not equalsmatch is not supported. I tried with other filter endsWith and contains still a same problem. Is there a filter available for this issue that I can use in my api call. FYI ne , contains, endsWith all of this filter are available in the documentation but not sure why it’s not working. Any alternatives would be helpful

https://graph.microsoft.com/v1.0/users?$filter=mail ne null

Some of the alternative filter were tested out:

https://graph.microsoft.com/v1.0/users?$filter=mail ne ‘Null’

https://graph.microsoft.com/v1.0/users?$filter=mail ne ‘ ‘

https://graph.microsoft.com/v1.0/users?$filter=endsWith(mail, ‘.com‘)

https://graph.microsoft.com/v1.0/users?$filter=contains(mail, ‘@‘)

Dummy JSON response structure:

value : {

givenName : Tim Charlie

mail : null

}

Microsoft Security Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,876 Reputation points
    2023-05-11T07:35:59.57+00:00

    Hi Pokemon Go , here's what I've tested and worked so far.

    https://graph.microsoft.com/v1.0/users?$filter=mail ne null&$count=true
    ConsistencyLevel: eventual
    
    https://graph.microsoft.com/v1.0/users?$filter=endsWith(mail, 'com')&$count=true
    ConsistencyLevel: eventual
    

    For ne and endsWith operators, it can be achieved by adding ConsistencyLevel header and $count parameter. Since ne and endsWith operators are all advanced queries, you need to add ConsistencyLevel header and $count parameter.

    User's image

    User's image

    User's image

    And for contains operator, it was confirmed that the contains operator only supports some APIs in a previous post.

    Hope this helps. Best Wishes.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

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