使用 Microsoft Graph API 返回具有空自定义扩展属性的客户

问题描述 投票:0回答:1

我想返回扩展属性未定义的客户列表,但似乎找不到方法来做到这一点。

我尝试使用“$filter=myExtendedPropName eq null”和“$filter=myExtendedPropName eq ''”,它返回错误“为资源“User”的属性“myExtendedPropName”指定了不支持或无效的查询过滤子句。”。当我使用相同的过滤器查询但使用客户上存在的值时,它会返回预期的数据,但我似乎无法过滤空值。

microsoft-graph-api azure-ad-graph-api
1个回答
0
投票

如果您在使用 null 值过滤扩展属性时错过添加 高级查询参数,通常会发生该错误。

当我在Graph Explorer中运行查询以获取具有null自定义扩展属性的用户时,我也遇到了相同的错误,如下所示:

GET https://graph.microsoft.com/v1.0/users?$filter=extension_xxxxxxxx_customerid eq null&$select=displayName,id,extension_xxxxxxxxx_customerid

回复:

enter image description here

如本 MS 文档中所述,

Requires advanced query
parameters.

$filter
运算符需要 高级查询参数,它们是:
ConsistencyLevel=eventual
标头和
$count=true
查询字符串。

解决错误,您需要添加高级查询参数,如下所示:

GET https://graph.microsoft.com/v1.0/users?$filter=extension_xxxxxxxx_customerid eq null&$select=displayName,id,extension_xxxxxxxxx_customerid&$count=true
ConsistencyLevel: Eventual

回复:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.