Bug? When using a $filter on employeeType to retrieve users, it doesn't work unless $count is also specified

Doug Chandler 2 Reputation points
2021-05-21T09:30:17.94+00:00

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?

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

4 answers

Sort by: Most helpful
  1. Danstan Onyango 3,816 Reputation points Microsoft Employee
    2021-05-26T04:22:57.127+00:00

    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.

    1 person found this answer helpful.
    0 comments No comments

  2. 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

    0 comments No comments

  3. 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.


  4. 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.

    0 comments No comments