Forum Discussion
How to use multiple filter operations in beta Graph API?
I am trying to run the following API:
https://graph.microsoft.com/beta/users?$count=true&$filter=signInActivity/lastSignInDateTime le 2022-09-01T00:00:00Z and endsWith(mail,'@alumni.xxx.xxx')
and I get the following response:
{
"error": {
"code": "BadRequest",
"message": "Filter not supported.",
"innerError": {
"date": "2022-12-22T19:21:39",
"request-id": "d994b51c-xxxx-xxxx-b0d5-97a8923ab5t9",
"client-request-id": "d302b51c-xxxx-yyyy-zzzz-12a8035ce9r9"
}
}
}
Any idea as to what I'm doing wrong?
Thx
- Mark_RulloCopper Contributor
Jeff Walzer Any luck? We're experiencing the same issue.
- Jeff WalzerIron Contributor
I had to add the following to the Request headers:
Key - ConsistencyLevel
Value - eventualAfter I added that, I was able to run the search:
https://graph.microsoft.com/beta/users?$count=true&$filter=signInActivity/lastSignInDateTime+le+2022-09-01T00:00:00Z&$filter=endsWith(mail,'@alumni.xxx.xxx')
- Mark_RulloCopper Contributor
Jeff Walzer thank you for the quick response!
https://graph.microsoft.com/beta/users?$filter=signInActivity/lastSignInDateTime le 2022-07-21T00:00:00Z&$filter=userType eq 'Guest'&$top=30
I tried that and I got this:
{"error": {"code": "BadRequest","message": "Query option '$filter/filter' was specified more than once, but it must be specified at most once.","innerError": {"date": "2023-01-17T00:45:17","request-id": "b1417012-d426-40d4-bc19-d44c07d1fedd","client-request-id": "b1417012-d426-40d4-bc19-d44c07d1fedd"}}}
- CloudHalIron Contributor
Jeff Walzer if you filter on signInActivity you cannot use any other filters, this is documented here https://learn.microsoft.com/en-us/entra/identity/monitoring-health/howto-manage-inactive-user-accounts
It's an extremely annoying limitation.