Matt Roberts
Matt Roberts

Reputation: 26897

Add a calendar event, and then later retrieve and update the event

Google Calendar has a simple API that allows you to add an event with an Id of your own choosing, as long as it meets some criteria. The beauty of this is that if you need to then update that event at a later date, you can just retrieve it by its id, then update it and post it back.. Job done.

I'm looking for a way to do this in Microsoft Graph, for a user's calendar. So far I can't see any obvious way to do this - I can't set the ID, and I can't see any "metadata"-esque fields that I can set and then reference to get that event back at a later date.

The only solution I can think of is to add the event, then store the event ID somewhere locally, so that I can later retrieve that event via its id. But I'd rather not have to store these event ids in my own database.

Any simple solutions?

Upvotes: 1

Views: 153

Answers (1)

Marc LaFleur
Marc LaFleur

Reputation: 33124

You most likely want to use Open Extensions. These are custom properties that get stored with the event in the user's calendar. You can use these extensions to retrieve events as well.

The one catch is that you will need to create the event first; you cannot create an event and add an extension in one operation. That said, your "storage" here is simply keeping the results from creating the event in memory so you can issue a second call using the id that was returned.

As an aside, it's worth noting that the id in Exchange is not safe to store since it can/will change if the event is moved. If you choose to store an identifier, you should use the iCalUId property. This property is guaranteed to be both unique and static (it's also portable so it is replicated across all the attendee instances as well).

Upvotes: 1

Related Questions