我正在尝试使用 Microsoft Graph API 获取具有特定许可证的用户列表。这可以使用 Graph Explorer 进行测试.
这是为一个用户返回的内容的裁剪示例:
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#users/$entity",
"id": "69615b5e-8b26-430c-ae89-4e626f5ba240",
"accountEnabled": true,
"assignedLicenses": [
{
"disabledPlans": [],
"skuId": "f8a1db68-be16-40ed-86d5-cb42ce701560"
},
{
"disabledPlans": [],
"skuId": "6fd2c87f-b296-42f0-b197-1e91e994b900"
}
]
}
我想获取所有已分配许可证且 skuId
为“f8a1db68-be16-40ed-86d5-cb42ce701560”的用户的列表
这是我到目前为止尝试过的:
https://graph.microsoft.com/beta/users?$filter=AssignedLicenses/any(a:a/SkuId eq 'f8a1db68-be16-40ed-86d5-cb42ce701560')
给我错误:
A binary operator with incompatible types was detected. Found operand types 'Edm.Guid' and 'Edm.String' for operator kind 'Equal'.
https://graph.microsoft.com/beta/users?$filter=AssignedLicenses/any(a:a/SkuId eq f8a1db68-be16-40ed-86d5-cb42ce701560)
给我错误:
')' or ',' expected at position 42 in 'assignedLicenses/any(a:a/skuId eq f8a1db68-be16-40ed-86d5-cb42ce701560)'.
https://graph.microsoft.com/beta/users?$filter=AssignedLicenses/any(a:a/SkuId eq cast('f8a1db68-be16-40ed-86d5-cb42ce701560',Edm.Guid))
给我错误:
The child type 'Edm.Guid' in a cast was not an entity type. Casts can only be performed on entity types.
这SO post表明我的第一次尝试会奏效,但事实并非如此。我是做错了什么还是无法通过许可分配进行过滤?
最佳答案
基于 document ,似乎此属性不支持过滤器,因为其他支持过滤器的属性,该文档将在描述文件中提到 accountEnabled
of user
资源类型(引用 this link )。
如果您需要此属性支持过滤器,您可以提交来自 here 的反馈。
关于odata - 使用 OData 过滤 guid (Microsoft Graph),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45953781/