microsoft-graph-apiazure-ad-graph-apimicrosoft-graph-calendaroutlook-calendaroutlook-api

Outlook calendar event id's are unique across tenant?


Am working with storing multiple tenants calendar events data on a single database. If calendar event-id are unique across tenant, I will use this as primary key to store unique events

Fetching data using Graph API events delta query

Thanks in advance..


Solution

  • My suggestion is that you'd better to use other key to be the primary key such as timestamp like 20210122125959333.

    Upon your question, I googled for help, and based on this document, it seems that there will be 2 same event id. But based on this one, it seems that event ids are unique.

    So I did some tests. I used creating event api to create calendar events, and I used the same parameters to test whether it will appear same id, and here is my conclusion.

    First, if I used the sample parameter(my url is: https://graph.microsoft.com/v1.0/me/calendar/events) in this document, after executing the api for several times, it will always return similar reponse but the event ids are the same(you can see details in screenshoot), but when I querying events by api, I can only get one event.

    enter image description here

    Then I set "transactionId" as "" and change the subject of event in parameter json(because when I just change the value of subject, it will return an error describes that I can't use the same transactionId), after executing serveral times, I can get different event ids even using the same parameter.

    So my suggestion is you shouldn't use event id as primary key unless your system doesn't care the operation metioned above which returning the same id and prepare to set up a good validation to avoid appearing same event id.