简体   繁体   English

Microsoft Graph API 不尊重 OData

[英]Microsoft Graph API not respecting OData

I'm attempting to pull all users within a specific group and to also get their transitive membership.我试图拉动特定组中的所有用户并获得他们的可传递成员资格。

The endpoint I am hitting is:我打的终点是:

https://graph.microsoft.com/v1.0/groups/{id}/transitiveMembers/microsoft.graph.user?$select=givenName,surname,country,city,companyName,officeLocation,displayName,mail,department,jobTitle,employeeId&$expand=transitiveMemberOf

This pulls the data I need, but there is an object of OData type microsoft.graph.group in the returned payload that causes the following error:这会拉出我需要的数据,但在返回的有效负载中有一个 OData 类型microsoft.graph.group的对象会导致以下错误:

A resource of type 'microsoft.graph.group' was found in a resource set that otherwise has entries of type 'microsoft.graph.user'. In OData, all entries in a resource set must have a common base type.

Which then causes a JSON parse error of unexpected token .然后导致unexpected token的 JSON 解析错误。 The response does contain the next link and I would like to be able to handle this error and move on to the next page.响应确实包含下一个链接,我希望能够处理此错误并转到下一页。 However, the JSON::ParserError prevents me from doing this.但是, JSON::ParserError 阻止我这样做。

Any ideas what might cause a microsoft.graph.group object to be returned when microsoft.graph.user was specified in the request url?当在请求 url 中指定microsoft.graph.user时,有什么想法可能导致microsoft.graph.group对象被返回?

To enable the advanced query capabilities for users and groups , set the ConsistencyLevel header set to eventual and use the $count query parameter:为 users 和 groups 启用高级查询功能,请将ConsistencyLevel标头设置为eventual并使用 $count 查询参数:

GET https://graph.microsoft.com/v1.0/groups/{id}/transitiveMembers/microsoft.graph.user?$select=givenName,surname,country,city,companyName,officeLocation,displayName,mail,department,jobTitle,employeeId&$expand=transitiveMemberOf&$count=true 
ConsistencyLevel: eventual

Let me know if this helps, and if you have further questions.如果这有帮助,请告诉我,如果您还有其他问题,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Microsoft Graph API - Odata 筛选器 - Microsoft Graph API - Odata Filter Microsoft Graph API @odata.type 是否包含“#”字符? - Does the Microsoft Graph API @odata.type include the “#” character? Microsoft Graph API odata $filter 查询似乎不起作用 - Microsoft Graph API odata $filter query does not appear to work Microsoft Graph API 元数据是否确认 OData 协议规范? - Does the Microsoft Graph API metadata confirm the OData Protocol specification? 在消息端点上使用 $search 参数时未返回 Microsoft Graph API @odata.count - Microsoft Graph API @odata.count not returned when using $search parameter on messages endpoint Microsoft 图形 - 列出电子邮件 - 禁用对 OData 的访问 - Microsoft graph - listing emails - Access to OData is disabled Microsoft Graph API 订阅端点提供了 @odata.nextLink,它给出了 404 - Microsoft Graph API Subscriptions endpoint provides @odata.nextLink that gives a 404 使用 PowerShell 时,基于类别颜色的 Microsoft 图形 api 列表消息计数返回不正确的 odata 计数 - Microsoft graph api list message count based on category color returns incorrect odata count when using PowerShell Microsoft Graph API Microsoft 登录 - Microsoft Graph API Microsoft Login Microsoft Graph API 错误 - Microsoft Graph API Errors
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM