question

HardyPhilippe-4003 avatar image
0 Votes"
HardyPhilippe-4003 asked SaifaliSanadi-5601 commented

ms graph, filter users using employeeType

Hello,

I'm trying to use the graph api to filter users using the field employeeType. In the documentation, it says this field supports $filter: https://docs.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0.

When I try this call: https://graph.microsoft.com/v1.0/users/?$filter=employeeType eq 'test'

It doesn't work. I get the error: Unsupported or invalid query filter clause specified for property 'employeeType' of resource 'User'.

Any idea why? The same thing happens in beta.

Thank you.

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.

Hello - let us look into this and get back to you.

1 Vote 1 ·

1 Answer

DianaWanjuhi-1579 avatar image
1 Vote"
DianaWanjuhi-1579 answered SaifaliSanadi-5601 commented

Hello @HardyPhilippe-4003 would you kindy add the $count query parameter and set the ConsistencyLevel header with the value of eventual. Your request should look something like this: https://graph.microsoft.com/v1.0/users?$filter=employeeType eq 'test'&$count=true. This should fix the issue.

Let me know if this helps,

Diana.

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

It works! Thank you. I didn't find anything about that trick in the documentation.

0 Votes 0 ·

im facing similar kind of issue
when i call

https://graph.microsoft.com/v1.0/users/messages?$filter=receivedDateTime ge 2021-10-10 and (from/emailAddress/address) eq 'reply@notifications-tst09.companyname.com'

It gives me error
{
"error": {
"code": "Request_UnsupportedQuery",
"message": "The specified filter against a single entity is invalid.",
"innerError": {
"date": "2021-10-11T03:48:26",
"request-id": "96765477-884d-43bf-8aab-c5a9f46c62ca",
"client-request-id": "96765477-884d-43bf-8aab-c5a9f46c62ca"
}
}
}

can you please help me to fix this issue ?

0 Votes 0 ·