-
Notifications
You must be signed in to change notification settings - Fork 232
Description
Hello,
We are using this library and the PageIterator to iterate over multiple pages that are returned from GET /v1.0/me/calendarView/delta.
If the calendar is empty, the response looks like this:
/v1.0/me/calendarView/delta?startDateTime=[omitted]&endDateTime=[omitted]
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(event)",
"@odata.nextLink": "https: //graph.microsoft.com/v1.0/me/calendarview/delta?$skiptoken=[omitted]",
"value": []
}
As you can see, values is empty but the response does not contain a deltaLink but a nextLink. Only on the second page (the second request) the response contains a deltaLink:
/v1.0/me/calendarview/delta?$skiptoken=[omitted]
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(event)",
"@odata.deltaLink": "https://graph.microsoft.com/v1.0/me/calendarview/delta?$deltatoken=[omitted]",
"value": []
}
Unfortunately, the PageIterator stops iterating if the response has no values and it does not fetch the second page:
msgraph-sdk-javascript/src/tasks/PageIterator.ts
Lines 86 to 88 in bed02c8
| if (self.collection === undefined || self.collection.length === 0) { | |
| return false; | |
| } |
Is there another way to make the PageIterator work with empty collections?
Would it make more sense to keep fetching pages until the first deltaLink is returned? I'm happy to contribute a PR for that.