Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filtering on proxyAddresses with Microsoft Graph API that endsWith or contains a string

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.

like image 400
Michael Tucker Avatar asked Nov 19 '25 11:11

Michael Tucker


1 Answers

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 $filter operators are not supported for Azure AD resources: ne, gt, ge, lt, le, and not. The contains string 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.

like image 152
Marc LaFleur Avatar answered Nov 21 '25 08:11

Marc LaFleur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!