[英]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.