Skip to content

PageIterator does not work on empty collections #129

Closed
@ChristianBoehlke

Description

@ChristianBoehlke

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions