Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net Microsoft Graph API查询因提供的筛选器而失败_.net_Azure Active Directory_Microsoft Graph Api_Azure Ad B2c - Fatal编程技术网

.net Microsoft Graph API查询因提供的筛选器而失败

.net Microsoft Graph API查询因提供的筛选器而失败,.net,azure-active-directory,microsoft-graph-api,azure-ad-b2c,.net,Azure Active Directory,Microsoft Graph Api,Azure Ad B2c,在我的.NET应用程序中,我尝试使用Microsoft Graph API从Azure AD B2C获取用户。我还想根据自定义用户属性筛选这些用户 我已经建立了这个URL https://graph.microsoft.com/v1.0/users?$select=extension_{Id}_lastUpdatedDate&$filter=extension_{Id}_lastUpdatedDate eq '2019-08-10' 这将返回400个错误,说明扩展名{Id}\u las

在我的.NET应用程序中,我尝试使用Microsoft Graph API从Azure AD B2C获取用户。我还想根据自定义用户属性筛选这些用户

我已经建立了这个URL

https://graph.microsoft.com/v1.0/users?$select=extension_{Id}_lastUpdatedDate&$filter=extension_{Id}_lastUpdatedDate eq '2019-08-10'
这将返回400个错误,说明
扩展名{Id}\u lastUpdateDate
不存在

{
  "error": {
    "code": "Request_UnsupportedQuery",
    "message": "Property 'extension_{Id}_lastUpdatedDate' does not exist as a declared property or extension property.",
    "innerError": {
      "request-id": "a925b2f4-fef8-47a1-b644-9b2e652f1746",
      "date": "2019-09-13T14:14:00"
    }
  }
}
但是,当我发送完全相同的请求时,除了查询的过滤器部分,如下所示

https://graph.microsoft.com/v1.0/users?$select=extension_{Id}_lastUpdatedDate
我收到了200个结果,听起来像是该字段存在,并且为广告中的所有用户正确填写

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(extension_{Id}_lastUpdatedDate)",
    "value": [
        {"extension_{Id}_lastUpdatedDate": "2018-07-12T14:31:47.208Z"}, 
        {"extension_{Id}_lastUpdatedDate": "2018-05-30T14:28:47.208Z"}, 
        {"extension_{Id}_lastUpdatedDate": "2018-06-30T14:28:47.208Z"}, 
        {"extension_{Id}_lastUpdatedDate": "2018-07-30T14:28:47.208Z"}, 
        {"extension_{Id}_lastUpdatedDate": "2018-08-30T14:28:47.208Z"}, 
        {"extension_{Id}_lastUpdatedDate": "2018-07-12T14:31:47.208Z"}, 
        {"extension_{Id}_lastUpdatedDate": "2018-07-30T14:31:47.208Z"}, 
        {"extension_{Id}_lastUpdatedDate": "2018-07-30T14:31:47.208Z"}
    ]
}

有人知道这里发生了什么吗?如果我在select查询中看到字段,则错误消息所说的内容对我来说几乎是不可能的。

我在我的租户中尝试了相同的方法,并且效果良好。在我的例子中,扩展属性shoesize是一个字符串。你能确认一下你分机的类型吗?并尝试使用type=string的扩展属性

https://graph.microsoft.com/v1.0/users?$select=extension_d09380e2b4c642b9a203fb816a04a7ad_ShoeSize&$filter=extension_d09380e2b4c642b9a203fb816a04a7ad_ShoeSize eq '12'
您也可以尝试AADGraph()


让我知道它是否适合你

目前,您仍然需要在AAD B2C中使用传统的Azure AD Graph API。从:

您必须使用来管理Azure AD B2C目录中的用户。这与Microsoft Graph API不同。了解更多


虽然有很多场景可以让你在AAD B2C上使用Microsoft Graph,但你会更经常或者不会被这样的事情绊倒。除非Microsoft Graph中有您特别需要的功能,否则在正式支持之前,我不会使用它

我遇到了同样的问题。API在$filter函数中区分大小写,但在$select函数中不区分大小写。因此,请确保您的$filter具有区分大小写的正确名称

这不起作用:

https://graph.microsoft.com/v1.0/users?$select=extension_{id}_tenantId,displayName&$filter=extension_{id}_tenantId eq 1
这项工作:

https://graph.microsoft.com/v1.0/users?$select=extension_{id}_tenantId,displayName&$filter=extension_{id}_TenantId eq 1

对查询Azure AD B2C租户的较新Microsoft Graph API的支持仍在开发中。我不认为我们可以通过MicrosoftGraphAPI得到相同的结果。我也在MicrosoftGraphExplorer中测试它。但对于
https://graph.microsoft.com/v1.0/users?$select=extension{Id}{custom attribute}
。您是如何创建自定义属性的?
https://graph.microsoft.com/v1.0/users?$select=extension_{id}_tenantId,displayName&$filter=extension_{id}_TenantId eq 1