microsoft-graph-apimicrosoft-graph-calendar

MS Graph, Calendar deltalink shows appointment as deleted when it is not


I'm using MS Graph to sync appointments between an Office 365 calendar and our app. I've set up a subscription for the resource and receive notifications for the created, updated and deleted events. I then use the deltalink I have stored for the subscription to get the changes. Most of the time this works very well.

However, sometimes after receiving a notification and using the deltalink, the results will show the appointment as deleted when it really isn't. IE, in the json it will only show "@removed":{"reason":"deleted"} and the id of the appointment. However when I then get the appointment with this id through the /calendar/events/{itemId} endpoint, I do get all the information of this appointment, meaning it's not deleted or it wouldn't even exist.

Once a subscription is in this state it doesn't appear to recover as the next deltalink will have the same problem. Deleting the subscription and getting a new deltalink will fix it.

I have no idea what causes this as the deltalink does get the right appointment, it just gives the wrong information for the appointment. I know that when I use an out of date deltalink I get a SyncStateNotFound error, but that's not the case here.


Solution

  • For people finding this thread in the future:
    I posted an answer in another similar thread: https://stackoverflow.com/a/78272484/8249461

    But in short, they have since the time of this post updated the docs to state that it is the expected behavior that the event delta shows the "@removed" status for events outside of that delta's date span range.

    So when using event delta, you will always have to check either whether the event is within the search date range, or check if it was actually deleted in Outlook/Azure.