1
votes

I'm currently working on the Microsoft Calendar Graph API and I ran into some problems when trying to synchronize events.

Basically what I have is 2 users on my web service : they both have an Outlook adress. User A create an event on my web service, and add User B as an attendee. The event is then send to Outlook using the REST API. It's created on User A Outlook calendar, and User B receive an invitation on Outlook and the event is created as well in his Outlook calendar.

Now, on my web service, when the event is created, I retrieve the Microsoft ID of the event and store it in my database. This way, when I want to synchronize events between Outlook calendar and my calendar, all I do is retrieve all Outlook events, check their ID and see if they are stored in my database : if they are, then the event already exists on my web service, if they are not then I create the event in my web service.

The problem I have is that when I try to get the Outlook events from User B, the ID of the event is different than the one I stored earlier, and therefore it creates a duplicate that I don't need.

Basically, the event on User A outlook calendar and User B outlook calendar have different ID. I don't understand what's the point of this, because they are the same, the one on User B outlook calendar is just an invitation to the one from User A outlook calendar.

My question is : is there any way I can get around that ? Is there any kind of ID that is shared through users in Outlook/Office365 ? Thanks a lot !

2

2 Answers

5
votes

This is precisely what the iCalUId property is for. The id is by design different, as it's a sort of "primary key" for the user's mailbox database. The iCalUId is supposed to be the same across calendars.

From https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/event:

iCalUId - String - A unique identifier that is shared by all instances of an event across different calendars.

-2
votes

There is AFAIK no property that is unique and also constant across different mailboxes. You can add custom properties to events, and make sure that the property value is unique and constant. That would require you to be able to write to User A's events.