0
votes

I am trying to use endsWith filter on /users endpoint but I feel like I'm losing my mind. It simply doesn't work for me in the official example:

https://developer.microsoft.com/en-us/graph/graph-explorer?request=users%3F%24count%3Dtrue%26%24filter%3DendsWith(mail%2C%27%40hotmail.com%27)%26%24select%3Did%2CdisplayName%2Cmail&method=GET&version=v1.0&GraphUrl=https://graph.microsoft.com&headers=W3sibmFtZSI6IkNvbnNpc3RlbmN5TGV2ZWwiLCJ2YWx1ZSI6ImV2ZW50dWFsIn1d

In this example, the problematic header 'ConsistencyLevel' is set, but it doesn't help. So what's going on here ? I'm actually interested in the 'mail' property for endsWith, but if the official example doesn't work than I'm not sure what to expect.

edit: enter image description here

1
Works fine for me. Does it return any error? I have User.ReadBasic.All permission. - user2250152
I have edited the post with the image of the error. I am actually using sample account and have not logged in, can that be the reason ? - Zed

1 Answers

1
votes

I have tried the same Query WITHOUT ConsistencyLevel:eventual and it failed with same error.

https://graph.microsoft.com/v1.0/users?$count=true&$search="displayName:room"&$filter=endsWith(mail, '@microsoft.com')&$orderBy=displayName&$select=id,displayName,mail

enter image description here

As a solution , I tried the same Query WITH ConsistencyLevel:eventual and it worked.

Note: Add the ConsistencyLevel Eventual in request header and provide the appropriate Consent permission to make it work.

https://graph.microsoft.com/v1.0/users?$count=true&$search="displayName:room"&$filter=endsWith(mail, '@microsoft.com')&$orderBy=displayName&$select=id,displayName,mail

enter image description here