I am new to using the Graph API and trying to use the beta version to get user information and want to filter based on userType and signInActivity/lastSignInDateTime. Individually the filters work fine on their own but together they error with a "filter not supported". This happens in the Graph Explorer also but the documentation indicates I should be able to filter on more than one thing? I can only think if it is a restriction of the signInActivity filter specifically that doesn't allow you to do another filter?
These both individually work:
https://graph.microsoft.com/beta/users?filter=userType eq 'Guest'&select=displayName,id
https://graph.microsoft.com/beta/users?filter=signInActivity/lastSignInDateTime ge 2021-05-01T00:00:00Z&select=displayName,id
However the following does not work and returns a "Filter not supported" error:
https://graph.microsoft.com/beta/users?filter=signInActivity/lastSignInDateTime ge 2021-05-01T00:00:00Z and userType eq 'Guest'&select=displayName,id
Any help would be appreciated!
I see a similar question was asked here Microsoft Graph - Error when using multiple filters for CalendarView but no answer currently.
I found the answer to this -- basically, to add multiple clauses to your $filter, simply add the word "and" to separate each criteria. this is the example I used and it seemed to work quite well:
https://graph.microsoft.com/beta/users?$count=true&$filter=endsWith(userPrincipalName,'mydomain.com') and accountEnabled eq false&$orderBy=userPrincipalName&$select=id,displayName,userPrincipalName,department,employeeid,jobtitle,accountEnabled
as it turns out, odata seems to not worry too much about spaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With