The user object has email addresses stored in a couple of properties: the mail and otherMails properties. Both of these properties can be used to search for certain users having the desired email addresses. Here is an example of how to use the filter query to search for user using mail property:

beta endpoint:

GET https://graph.microsoft.com/beta/users?$filter=mail eq ‘john@contoso.com’

v1.0 endpoint:

GET https://graph.microsoft.com/v1.0/users?$filter=mail eq ‘john@contoso.com’

Unlike the mail attribute (string-type property), the otherMails attribute is a Collection of strings so we need to use the Any() function to do any searching on this property. Below are a couple of examples using the v1.0 endpoint:

GET https://graph.microsoft.com/v1.0/users?$filter=otherMails/any(x:x eq ‘xxx@abc.com’)

GET https://graph.microsoft.com/v1.0/users?$filter=otherMails/any(x:startswith(x, ‘xxx’))

Note: not every user object property supports filter query. Check the documentation for the resource to see which property is “filterable”.

In the example below from the User object, the licenseAssignmentStates property does not support filter while the mail property does

Leave a Comment