【问题标题】:Unsupported or invalid query filter clause specified for property 'mobilePhone' of resource 'User'. in Azure AD access via graph query为资源“用户”的属性“移动电话”指定了不受支持或无效的查询过滤器子句。在 Azure AD 中通过图形查询访问
【发布时间】:2022-01-20 12:31:06
【问题描述】:

我正在尝试从 azure AD 访问基于某些属性(手机)的用户,但出现上述错误 我什至尝试添加 ConcistencyLevel 标头和 count = true 查询参数但没有成功 我的代码如下

try
            {
                ClientSecretCredential authProvider = new ClientSecretCredential("*******", "********", "*********");
                List<Option> options = new List<Option>
                {
                    //new QueryOption("count", "true"),
                    //new HeaderOption("ConsistencyLevel","eventual")
                };
                var graphClient = new GraphServiceClient(authProvider);
                var user = await graphClient.Users.Request(options).Filter("mobilePhone eq '1111222223333'").GetAsync();
            }
            catch (Exception ex)
            {

            }

请告诉我我错过了什么

【问题讨论】:

    标签: .net-core azure-active-directory microsoft-graph-api


    【解决方案1】:

    我可以通过在计数参数中添加 $ 来过滤

    我的工作代码是

    try
                {
                    ClientSecretCredential authProvider = new ClientSecretCredential("*******", "********", "*********");
                    List<Option> options = new List<Option>
                    {
                        new QueryOption("$count", "true"),
                        new HeaderOption("ConsistencyLevel","eventual")
                    };
                    var graphClient = new GraphServiceClient(authProvider);
                    var user = await graphClient.Users.Request(options).Filter("mobilePhone eq '1111222223333'").GetAsync();
                }
                catch (Exception ex)
                {
    
                }
    

    【讨论】:

      猜你喜欢
      • 2020-04-27
      • 1970-01-01
      • 1970-01-01
      • 2017-03-24
      • 1970-01-01
      • 2020-01-12
      • 1970-01-01
      • 2014-04-18
      • 2013-05-25
      相关资源
      最近更新 更多