Article
0 comment

Make iCalender events sent with Power Automate update-able

In the last post, I showed how sending events via Power Automate is possible. While those events don’t have any functionality to update them when the original entry changed. We need a small adjustment to the flow to make this work.

Unique ID for ICalendar event

One important property of an ICalender event is the so-called unique identifier, which enables the calendar application to find the same event again in case the data of the event changes.
This Unique ID property is stored in the property UID.

While we could create a unique ID in Power Automate, this is not what we want. Next time the flow runs, we get a different unique ID that would make a new event instead of updating an existing one.

As it turns out, there is no specific format in which the unique identifier gets added to the ICal-entry. However, the documentation recommends using a Universally Unique Identifier (UUID) or GUID (Global Unique Identifier).

How to get a GUID for an event

Here is the catch: while the out-of-the-box fields do not show the GUID value of a list item, every list item and document stored in SharePoint gets equipped with a unique ID.

The problem is the “Get Item from List”-action does not allow you to request the ID. Instead, we need to use a “Send an HTTP request to SharePoint”-action to retrieve it.

The URI method to use goes like this:

/_api/web/lists/getbytitle('Events')/items/getbyid(1)/?$select=UniqueId

First, get the list by title, get the items, get the item by ID and select the uniqueID by $select=UniqueID.

Screenshot of HTTP Request entry

HTTP Request to get Unique ID

It will return SharePoint’s unique identifier of the list item. If you change the event entry in future, this field will always have the initial value after creating the list entry.

In the next step, we need to parse the JSON result for convenience and generate the schema from the result of the previous set action.

Screenshot of JSON parser to get UID

Parse JSON to get unique ID

Now that we have the unique ID field, we can add it to the “Set varICSEvent” step.

UID:@{body('Parse_JSON')?['d']?['UniqueId']}

Or as visually like this:

#image_title

We keep the rest the same as in the previous blog post on iCalender events.

Update in Outlook

With everything in place, we can send the event with its original date again and add it to the calendar. You might create a duplicated event entry, but it contains the unique identifier this time.

#image_title

After you change the calendar entry in the list to a different date, start the flow again. You should get again a new event. This time, adding it to the calendar moves the original entry to the new date.

Happy Power Automate hacking.

Leave a Reply

Required fields are marked *.


This site uses Akismet to reduce spam. Learn how your comment data is processed.