question

DougChandler-5606 avatar image
0 Votes"
DougChandler-5606 asked DougChandler-5606 answered

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?

microsoft-graph-users
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Are you calling Graph beta or v1.0? Could you provide the full request URL.

0 Votes 0 ·
dougchandler avatar image
0 Votes"
dougchandler answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Danstan-MSFT avatar image
1 Vote"
Danstan-MSFT answered

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.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

dougchandler avatar image
0 Votes"
dougchandler answered Danstan-MSFT commented

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.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I will look at this further. Please consider accepting the answer to help other community users.

0 Votes 0 ·
DougChandler-5606 avatar image
0 Votes"
DougChandler-5606 answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.