我有一个Microsoft Graph用户,其中包含以下属性:
"onPremisesExtensionAttributes": {
"extensionAttribute1": "attr1",
"extensionAttribute2": null,
"extensionAttribute3": null,
"extensionAttribute4": null,
etc.
},
我似乎无法找到有关如何过滤此属性的任何文档或示例。我试过了:
https://graph.microsoft.com/beta/users?$filter=extensionAttribute1 eq 'attr1'
https://graph.microsoft.com/beta/users?$filter=onPremisesExtensionAttributes/extensionAttribute1 eq 'attr1'
https://graph.microsoft.com/beta/users?$filter=onPremisesExtensionAttributes/any(x:startswith(x,'attr1'))
所有这些都会导致错误的请求,所以显然有些问题。
"code": "BadRequest",
"message": "Invalid filter clause",
问题:如何针对onPremisesExtensionAttributes或包含命名属性列表的任何其他属性(例如extensionAttribute1 ... n)格式化过滤器?对于字符串列表(例如proxyAddresses),您可以这样做:
$filter=proxyAddresses/any(x:startswith(x,%27smtp:myemail%27))
答案 0 :(得分:0)
您现在可以过滤 onPremisesExtensionAttributes
:
https://graph.microsoft.com/v1.0/users?$count=true&$filter=onPremisesExtensionAttributes/extensionAttribute1 eq 'attr1'
需要注意的两个要点:
ConsistencyLevel
标头设置为 eventual
。否则,您将收到 400
状态代码,并显示以下消息 Property 'extensionAttribute1' does not exist as a declared property or extension property.
$count=true
,否则您将收到带有以下消息 400
Property 'extensionAttribute1' does not exist as a declared property or extension property.
状态代码