This looks looks like a known issue as it seems the $filter=employeeType eq 'val' only works with both ConsistencyLevel header set to eventual and $count=true. See this thread. There is also this GitHub issue which states that.
Bug? When using a $filter on employeeType to retrieve users, it doesn't work unless $count is also specified
When using MSGraph to retrieve users via a $filter on employeeType, unless also specifying $count it gives an error. With the $Count it works perfectly.
I have tried through PowerShell code (I have a PowerShell class to communicate with the MS Graph API), and Graph explorer.
Anyone else seen this, it looks like a bug?
4 answers
Sort by: Most helpful
-
Danstan Onyango 3,816 Reputation points Microsoft Employee
2021-05-26T04:22:57.127+00:00 -
Doug Chandler 2 Reputation points
2021-05-25T22:46:57.627+00:00 Example:
https://graph.microsoft.com/v1.0/users?$filter=employeeType eq 'V'
- fails with Request_UnsupportedQuery
https://graph.microsoft.com/v1.0/users?$filter=employeeType eq 'V'&$count=true
- works -
Doug Chandler 2 Reputation points
2021-05-26T09:47:47.533+00:00 Great, it is recognised as an issue, but looks like it has been closed as resolved but is far from it :(
I could get it to work in GraphExplorer with the $count=true, but not in my code, then I see in the issue about the consistencylevel header which I need to add to my code.
At least I have a workaround, thanks, but I wish they would fix the bug. -
Doug Chandler 2 Reputation points
2021-06-02T16:28:36.283+00:00 OK, strange that it was designed to work this way, especially if you don't need the count, just the data.
I think the documentation needs to be clearer to indicate that you might be able to filter on employeeType but you need to specify $count and consistencyLevel.