使用Microsoft Graph API在proxyAddresses上进行筛选,结束于或包含字符串
问题描述:
我需要找到具有以特定字符串结尾的proxyAddress的用户和组,例如, @acme.com
。使用Microsoft Graph API在proxyAddresses上进行筛选,结束于或包含字符串
我可以做startsWith:
$filter=proxyAddresses/any(x:startswith(x,'smtp:johndoe'))
或者等于:
$filter=proxyAddresses/any(x:x eq 'smtp:[email protected]')
不过的endsWith,包含像似乎不工作:
$filter=proxyAddresses/any(x:contains(x,'*@acme.com'))
在
和结果错误的请求。
答
Microsoft Graph端点不支持endsWith
,并且支持contains
的端点数量有限。在这种情况下,Azure AD实体不支持contains
。从documentation on $filter:
注:以下
$filter
运营商不支持Azure的AD资源:ne
,gt
,ge
,lt
,le
和not
。目前在任何Microsoft Graph资源上都不支持contains
字符串运算符。
另外,您用于contains
的语法也有点偏离。正确的语法是contains({property},'{subString}')
。它类似于startsWith
,不需要/支持通配符。
谢谢马克!你知道有没有计划支持endsWith或contains?为了强大的搜索功能,目前它似乎非常有限 –
我还没有听到有关'endsWith'的任何信息,但我知道有很多开发人员对支持'contains'感兴趣。然而,这不是微不足道的,所以我不想在ETA上猜测它。 –
Michael,请提出申请,请求UserVoice上的endsWith或contains:https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/category/101632-microsoft-graph-o365-rest-apis –