odata - 使用 OData 过滤 guid (Microsoft Graph)

标签 odata azure-active-directory microsoft-graph-api

我正在尝试使用 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/

相关文章:

azure - Xamarin.Forms Azure 移动应用服务离线同步,无需在 Azure 上托管 Web Api

asp.net-core - 如何修复 "AADSTS90102: ' redirect_uri' 值必须是有效的绝对 Uri。“Microsoft Graph 中的错误

microsoft-graph-api - 从 Microsoft Graph 获取仅限应用范围的任务列表

microsoft-graph-api - Graph API 中的 findMeetingTimes 端点似乎无法使用仅限应用程序的权限访问

java - 使用 SAP Cloud SDK 版本 3.2.0 向 OData 服务发送 POST 请求时如何避免 DestinationAccessException

jpa - odata 协议(protocol)是 REST 服务的良好标准吗?

odata - sapui5表只显示相同的记录

wcf - 如何处理从WCF数据服务(OData)返回的json DateTime

active-directory - 写入请求仅在包含的实体上受支持,Microsoft Graph API 在尝试 PATCH/POST 以将 AD App 角色分配给用户时

microsoft-graph-api - Onedrive : no delta and no webhook push for shared file 的 MS Graph Api