I need to find users and groups with a proxyAddress that endsWith a specific string, e.g. @acme.com.
I can do startsWith:
$filter=proxyAddresses/any(x:startswith(x,'smtp:johndoe'))
Or equals:
$filter=proxyAddresses/any(x:x eq 'smtp:[email protected]')
But endsWith, contains, like don't seem to work:
$filter=proxyAddresses/any(x:contains(x,'@acme.com'))
and results in a BadRequest.
Microsoft Graph endpoints don't support endsWith and there is a limited number of endpoints that support contains. In this case, contains isn't supported by Azure AD entities. From the documentation on $filter:
Note: The following
$filteroperators are not supported for Azure AD resources:ne,gt,ge,lt,le, andnot. Thecontainsstring operator is currently not supported on any Microsoft Graph resources.
As an aside, the syntax you used for contains is also a bit off. The correct syntax would be contains({property},'{subString}'). It is similar to startsWith and doesn't require/support wildcards.
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