Duplicate event IDs in MS Graph API

Viewed 498

I have the same issue as has been reported here but I can't seem to find a follow-up question. For the sake of completeness, this is what this person reported and it's the same as my issue:

"We are storing the calendar event id in our DB, and have noticed that there are duplicate Ids being set for graph. Perhaps we need to be using the iCalUid which stays unique, although it is not apparent that we should be using this in the Microsoft documentation. Furthermore, requesting an event by iCalUid requires filtering through optional parameters, where as the Get method for event simply uses the Id. Again, not so obvious.

Repro steps:

  • Write a console app and creates x amount of events with the same start, end, owner, subject, location, etc.
  • Run it once with 5 events. Then run it again with 5 events.
  • Finally, run it again for 100 events.

You should see that the ids from the first 2 batches, appears in the 3rd (larger) batch."

I'm fresh out of ideas. There are no exceptions and everything seems normal but we get duplicate event IDs when we create a large number of events with roughly the same properties (start and end times may differ).

How can we solve this duplicate event id issue?

1 Answers

I may have found the culprit: a case insensitive database. I'd have to investigate but it seems that the ID increments a part of its key using lowercase and uppercase letters. Some event ids are exactly the same apart from one letter like RAAA= vs rAAA=.

Adding a case sensitive collation to the SQL Column seemingly fixes the issue:

[EventId] NVARCHAR(450) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL

Not sure if this is the actual cause and/or solution but suddenly all of our errors have disappeared.

Related