【问题标题】:Filtering users by business phone number with MS Graph API fails使用 MS Graph API 按企业电话号码过滤用户失败
【发布时间】:2021-07-30 08:14:38
【问题描述】:

根据MS Graph API documentationbusinessPhones 支持在 $filter 查询中使用 eq 比较,就像 imAddresses 属性。

在查看 Microsoft 的 use query parameters 文档时,有一个示例,其中 imAddresses 属性在集合过滤器中使用并且工作正常。

GET https://graph.microsoft.com/v1.0/users?$filter=imAddresses/any(s:s eq 'admin@contoso.com')

我的目标是列出在其 businessPhones 集合属性中具有特定电话号码的所有用户。 但是,当我尝试在类似查询中使用 businessPhones 属性时,查询无法按预期工作。

GET https://graph.microsoft.com/v1.0/users?$filter=businessPhones/any(s:s eq '1234')

状态码:400

{
    "error": {
        "code": "Request_UnsupportedQuery",
        "message": "Unsupported or invalid query filter clause specified for property 'businessPhones' of resource 'User'.",
        "innerError": {
            "date": "2021-07-30T08:07:24",
            "request-id": "ac3923be-de11-448f-b2b5-245edc82d20e",
            "client-request-id": "ac3923be-de11-448f-b2b5-245edc82d20e"
        }
    }
}

关于我缺少什么的任何想法?

【问题讨论】:

  • 从错误消息看来,此字段不受支持,文档对此并不清楚。让我跟进。

标签: microsoft-graph-api odata


【解决方案1】:

您需要使用advanced query capabilities,这意味着您需要在请求中添加$count=true 查询字符串参数和ConsistencyLevel=Eventual 标头。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-12
    • 2021-08-01
    • 1970-01-01
    相关资源
    最近更新 更多