【问题标题】:Filtering on proxyAddresses with Microsoft Graph API that endsWith or contains a string使用以结尾或包含字符串的 Microsoft Graph API 过滤 proxyAddresses
【发布时间】:2023-04-05 19:21:01
【问题描述】:

我需要查找具有以特定字符串结尾的 proxyAddress 的用户和组,例如@acme.com

我可以做startsWith:

$filter=proxyAddresses/any(x:startswith(x,'smtp:johndoe'))

或等于:

$filter=proxyAddresses/any(x:x eq 'smtp:johndoe@acme.com')

但endsWith、contains、like似乎不起作用:

$filter=proxyAddresses/any(x:contains(x,'@acme.com'))

并导致 BadRequest。

【问题讨论】:

    标签: office365 microsoft-graph-api office365api


    【解决方案1】:

    Microsoft Graph 终结点不支持endsWith,支持contains 的终结点数量有限。在这种情况下,Azure AD 实体不支持 contains。来自documentation on $filter

    注意: Azure AD 资源不支持以下 $filter 运算符:negtgeltlenot .任何 Microsoft Graph 资源目前都不支持 contains 字符串运算符。

    顺便说一句,您用于contains 的语法也有点偏离。正确的语法是contains({property},'{subString}')。它类似于startsWith,不需要/支持通配符。

    【讨论】:

    • 谢谢马克!您知道是否有计划启用对 endsWith 或 contains 的支持?对于强大的搜索,目前它似乎非常有限。
    • 我没有听到任何关于 endsWith 的消息,但我知道有很多开发人员对支持 contains 感兴趣。然而,实现起来并非易事,所以我不想猜测它的 ETA。
    • Michael,请在 UserVoice 上提交endsWith 或 contains 请求:officespdev.uservoice.com/forums/…
    • 谢谢丹!我发布了这个想法:officespdev.uservoice.com/forums/…
    猜你喜欢
    • 1970-01-01
    • 2018-10-16
    • 2018-11-10
    • 1970-01-01
    • 1970-01-01
    • 2019-09-25
    • 1970-01-01
    • 1970-01-01
    • 2022-08-15
    相关资源
    最近更新 更多