问题
I'm working with the Microsoft Graph API I'm using the Delta API for groups. I create one delta request per group (I'm not tracking all groups, only specific ones).
I have checked this question and read the documentation mentioned. And I have read the issue on GitHub here
I'm working against the same tenant while developing for few weeks with the delta response. Besides once, it always worked almost as expected. When I made a delta request I got the nextLink, I followed it until I got the deltaLink. I'm saying it almost work as expected, because a lot of times, after the first/two responses with data, I got most of the time another 1-3 next links with no additional data.
The last time I have tried, I got around 150 responses with nextLinks until the function timeout, all of those response besides the first few, had no data in it.
This is a testing environment with around 30 users on the group.
I have used
https://graph.microsoft.com/v1.0/groups/delta?$select=id,displayName,members&$filter=id eq 'groupId'`
In the infinite loop those are the kind of responses I get
{
"id":"402-xxx-ee0",
"status":200,
"headers":{
"Preference-Applied":"odata.track-changes",
"Cache-Control":"no-cache",
"OData-Version":"4.0",
"Content-Type":"application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8"
},
"body":{
"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#groups",
"@odata.nextLink":"https://graph.microsoft.com/v1.0/groups/delta?$skiptoken=5ZZ_<long_token>_OXWrtiE",
"value":[
]
}
}
As you can see their is no data in the value, but still I get nextLink When I'm following this next link I'm getting
{
"id":"402-xxx-ee0",
"status":200,
"headers":{
"Preference-Applied":"odata.track-changes",
"Cache-Control":"no-cache",
"OData-Version":"4.0",
"Content-Type":"application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8"
},
"body":{
"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#groups",
"@odata.nextLink":"https://graph.microsoft.com/v1.0/groups/delta?$skiptoken=5ZZ_<long_token>_DNF5rRE0",
"value":[
]
}
}
As you can see, another response, with another next link (a different one) which again return empty value.
This happens again an again until my function timed out.
I'm expecting to get the deltaLink before at the first response with no more data, or at the maximum at the first empty response.
回答1:
Responses with an empty array as the value and a nextlink are a normal behavior of the delta function for identity entities (users, groups, applications, service principals...) indicating that not all changes have been enumerated and replication of changes is happening in the backend.
Whenever you are presented with this situation (empty array + next link), your application should pause before querying the nextlink, giving time for replication to happen and avoiding an infinite loop.
If you see this behavior happening too often under normal conditions you should contact support.
来源:https://stackoverflow.com/questions/62150331/microsoft-graph-api-groups-delta-never-returns-deltalink-which-is-causing-infin