我試圖使用Microsoft Graph API獲取具有特定許可證的用戶列表。這可以使用Graph Explorer進行測試。使用OData在guid上過濾(Microsoft Graph)
這是什麼返回一個用戶裁剪例如:
{
"@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"
}
]
}
我想有一個分配的許可證以「f8a1db68-be16-40ed-86d5- skuId
所有用戶的列表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表明,我第一次嘗試的工作,但事實並非如此。我做錯了什麼,或者只是無法通過許可分配進行過濾?