【问题标题】:Microsoft Graph filter is getting an error of Unsupported QueryMicrosoft Graph 筛选器出现“不受支持的查询”错误
【发布时间】:2023-01-14 08:49:47
【问题描述】:

我试图让所有用户不在特定域中。我直接使用 Microsoft 的 Graph 文档 here 中的过滤器。但是,Graph 返回不支持的查询错误。我很难过。

询问:

            var usersPage = await _graphClient
            .Users
            .Request()
            .Filter("not(endsWith(mail, 'excludeddomain.com'))")
            .GetAsync();

【问题讨论】:

    标签: asp.net-core microsoft-graph-api


    【解决方案1】:

    我想到了。使用“ne”或“not”等运算符需要高级查询功能。要获得高级查询功能,您必须"must add the ConsistencyLevel header set to eventual and use the $count=true query string."

    正确语法:

               var usersPage = await _graphClient
                .Users
                .Request(new Option[] { new QueryOption("$count", "true") })
                .Header("ConsistencyLevel", "eventual")
                .Filter("not(endsWith(mail, 'excludeddomain.com'))")
                .GetAsync();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-14
      • 2016-06-04
      • 1970-01-01
      • 1970-01-01
      • 2018-11-10
      • 1970-01-01
      • 2021-03-31
      • 1970-01-01
      相关资源
      最近更新 更多