Useful User (Endpoint) Filtering
The collection size of a request to
/users cannot be feasibly limited.
Our active directory has tens of thousands of entries. The API only enables retrieving 100 entries per request. Getting ALL the entries takes a long time and I don't need them ALL. Unfortunately, the options for filtering the request are quite chintzy.
I can use the eq (equal) filter, which would be fine if looking for a single user, but I'm trying to limit the resulting collection to a group of users (e.g. to users who's displayName contains a substring, or where surname is not null). I cannot even use the not equal filter. I receive the following reply:
"Unsupported property filter clause operator 'NotEqualsMatch'."
endswith is not supported. regular expressions are not supported.
search.in is not supported.
Not to mention, the user object only has a few useful properties.
filter endsWith support for mail and userPrincipalName is currently under development.
Derek Gabriel commented
How about filtering on user type?
https://graph.microsoft.com/beta/users?$filter=userType eq Member&$count=true
Definitely. Want to filter by UPN using something other than startsWith but seems like that's the only supported string parsing
I definitely want to see filtering expanded to include all of the properties on the user objects. The set available right now extremely limiting!
I want to search on onPremisesDistinguishedName, onPremisesSamAccountName, etc.
Stephan Steiner commented
Might be good to split this up into a request to support the equals tag in $filter, and one to support the contains tag in $filter.