Calendar API pagination returning duplicate events

Davison, D.P. (EEMCS) 1 Reputation point
2022-08-29T13:10:28.467+00:00

I noticed some strange behaviour with the calendar API endpoint for shared calendars. This seems related to pagination (using $top and $skip) and occurs when there are deleted events.

For my account it is possible to reproduce the issue as follows:

  1. My main account has access to a shared calendar with SHARED_CALENDAR_ID and I can access events on the following endpoint: https://graph.microsoft.com/v1.0/me/calendars/[SHARED_CALENDAR_ID]/events
  2. Starting with a completely empty calendar (all events removed), I now create 3 events through the regular Outlook GUIs. Events have subject "Test1", "Test2", "Test3"
  3. Calling the endpoint with parameter $top=2 will now return the top 2 events on the first page (e.g. "Test3" and "Test2"). The result also includes an URL @odata.nextLink to the next page of results (with appended parameter $skip=2). Calling this URL returns the last event "Test1", as expected.
  4. Now the weird thing happens when I delete one of the events (e.g. delete "Test2").
  5. Now I call the endpoint again with $top=2, this returns both remaining events ("Test3" and "Test1" as expected), but it also includes the @odata.nextLink property. Clicking this returns a duplicate event "Test1" which was already retrieved previously.

This becomes very messy very quickly with calendars that contain many events and deleted events. Now my handling code needs to be aware of duplicates, requiring extra processing and unnecessary API calls to retrieve all events. For my account it only seems to occur for shared calendars. I'm wondering whether this is a bug? Have other people encountered this? Any advice how to further troubleshoot or deal with this issue?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,483 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sheena-MSFT 1,721 Reputation points
    2022-08-31T14:39:42.387+00:00

    Hi @Davison, D.P. (EEMCS) ,

    I tried to replicate this scenario but it is working as expected. I would suggest to raise a case with MS Support team aad.portal.azure.com from your tenant where you are facing issue respective team will address your issue accordingly.

    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".

    0 comments No comments