我正在尝试查询Graph,以获取具有特定许可证的所有用户。
我有以下数据: https://graph.microsoft.com/v1.0/users?$ select = id,assignedLicenses
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(id,assignedLicenses)",
"value": [
{
"id": "6e7b768e-07e2-4810-8459-485f84f8f204",
"assignedLicenses": []
},
{
"id": "87d349ed-44d7-43e1-9a83-5f2406dee5bd",
"assignedLicenses": [
{
"disabledPlans": [],
"skuId": "c7df2760-2c81-4ef7-b578-5b5392b571df"
}
]
},
{
"id": "5bde3e51-d13b-4db1-9948-fe4b109d11a7",
"assignedLicenses": [
{
"disabledPlans": [],
"skuId": "90d8b3f8-712e-4f7b-aa1e-62e7ae6cbe96"
},
{
"disabledPlans": [],
"skuId": "725422ed-e205-400e-ab0a-3899d8a398ca"
},
{
"disabledPlans": [],
"skuId": "c7df2760-2c81-4ef7-b578-5b5392b571df"
}
]
}
]
}
我的最终目标是计算拥有此许可证的所有用户:“ c7df2760-2c81-4ef7-b578-5b5392b571df” 但是作为开始,我试图只列出所有这些用户的列表。
但是在拨打电话时: https://graph.microsoft.com/v1.0/users?$ filter = assignedLicenses / any(a:a / skuId eq'c7df2760-2c81-4ef7-b578-5b5392b571df')
我遇到以下异常:
{
"error": {
"code": "BadRequest",
"message": "Invalid filter clause",
"innerError": {
"request-id": "9a4837b1-cbcf-4c0b-a54e-168959aeb4d8",
"date": "2019-08-12T07:47:12"
}
}
}
答案 0 :(得分:0)
但是在拨打电话时:
https://graph.microsoft.com/v1.0/users?$filter=assignedLicenses/any(a: a/skuId eq 'c7df2760-2c81-4ef7-b578-5b5392b571df')
我遇到了[例外]。
改为尝试此呼叫:
https://graph.microsoft.com/v1.0/users?$top=999&$filter=assignedLicenses/any(x:x/skuId eq c7df2760-2c81-4ef7-b578-5b5392b571df)