Creating iCal (.ics) calendar item links with a workflow (Power Automate or SharePoint Designer)

When working with calendars, a big request I hear is to make it more like Outlook or to make it easy to add an event to your calendar, at least. In SharePoint online, this is easy! The Events web part on modern pages includes an Add to my calendar button on events by default.

Click to enlarge

However, when working with classic pages or SharePoint Server/on-prem, it’s not so easy. There are two ways we might utilize Power Automate or SharePoint Designer to help us out:

  • We could create a hyperlink column if we want something on-page/in-item, then populate it using a workflow.
    • Usage idea: A landing page for upcoming training opportunities displayed in list (not calendar) format with a column designated for “Add to my calendar” links
  • If it doesn’t need to be clickable on the item or page within SharePoint, we could just build the URL within the workflow and include it in an email message.
    • Usage idea: A Flow that runs weekly to “Get items” coming up that week and sends a list out with clickable links for adding items of interest to recipients’ calendars

URL structure

No matter the tool, Power Automate or SharePoint Designer, the most important part to know is how to build the URL. That won’t change from one tool to the other.

1. Go the the list settings for the calendar hosting the events

Click to enlarge

2. Copy the list GUID from the URL in the browser. This includes everything in the address bar after “List=”. This should begin with %7B and end with %7D. This is your calendar’s GUID in hyperlink-friendly formatting.

ical4
Click to enlarge

3. Update the following URL template with your site’s path, and paste in the list/calendar GUID you copied from step 2 where GUID is. Leave the [ID] as it is for now.

https://Site or Subsite path/_vti_bin/owssvr.dll?CS=109&Cmd=Display&List=GUID&CacheControl=1&ID=[ID]&Using=event.ics 

Your almost-finished result should resemble this:

https://natechamberlain.sharepoint.com/_vti_bin/owssvr.dll?CS=109&Cmd=Display&List=%7B1EC8795A-3B1D-43D7-A49E-B1CCD4BFF950%7D&CacheControl=1&ID=[ID]&Using=event.ics 

Now we have everything we need to finish the process by using whichever workflow platform you prefer or have access to.

Create iCal (.ics) links using Power Automate

No matter where you’re using the URL in your flow, we’ll create it as an expression so we can use the concat() function.

If you just want to update a field, or create a variable, with the URL, it’s as simple as:

1. Paste the URL part you have from the previous section of this post

2. Delete [ID]

3. With your cursor still where [ID] was, use the dynamic content panel to search for and insert ID in its place.

If you want to populate an actual hyperlink format column with a label/description that’s prettier than the full URL, however, you’ll need to do a bit more work so that you can have both URL and description. Follow the steps in this post on updating hyperlink or picture format columns using Power Automate.

If not updating a field or creating a variable that pieces the URL together, you can create expressions (via Dynamic content panel) to concatenate the different parts of the URL. For example, if I’m creating an HTML table, for Value I’d use the dynamic content panel > Expression and enter a formula like:

concat('<a href="https://natechamberlain.sharepoint.com/_vti_bin/owssvr.dll?CS=109&Cmd=Display&List=%7B1EA8795A%2D3B0D%2D43D7%2DA48E%2DB3CCD4BFE950%7D&CacheControl=1&ID=',item()?['ID'],'&Using=event.ics">Add to my calendar</a>')

In this specific example, I’m creating the table after a “Get items” step. The formula above is what I’m using for the value of the “Save” (Add to Calendar) column.

Check out this post for full instructions on sending weekly emails of upcoming events with easy “Add to calendar” links using Flow.

Create iCal (.ics) links using SharePoint Designer

In SharePoint Designer, we can set a hyperlink field to our iCal link to make it easy to add an event to your calendar. This could be placed as a main column in a list view, or just on item display forms like this:

Let’s set the hyperlink field via workflow:

1. Create a variable (set workflow variable) and use the string builder

2. Paste your almost-finished URL from earlier in this post. Replace [ID] with a lookup to the current item’s ID

3. If setting a field (skip if just using the link elsewhere) add , Add to Calendar (or whatever link text you want) to the end of the string. It just has to be a comma, a space, and the text.

Click to enlarge

4. Set the hyperlink field (iCal in my example above) to your new variable.

If you’re not setting a field in your list, maybe you’re emailing new events to people and want an easy link in the email body itself. In that case, just skip step three above and your variable will just be the URL, ready to be used in email actions.

Click to enlarge

Why can’t we just use calculated columns?

Once upon a time, I blogged about creating Automatic iCal hyperlinks using a calculated column. This almost works. It creates the hyperlinks for all existing items at the time of the calculated column’s creation. But then if you add a new item or modify an existing item, the [ID] field drops out the hyperlink which, of course, breaks the link.

The appeal of calculated columns is that it won’t create another version of an item when the link is generated and it doesn’t require Power Automate or SharePoint Designer to work. Unfortunately, if the link doesn’t work after item edit or creation, then the point is lost anyway. So let’s pretend that method doesn’t exist except for one-time uses or lists that will never change again.

3 Replies to “Creating iCal (.ics) calendar item links with a workflow (Power Automate or SharePoint Designer)”

  1. Is there a way to have the string you create in SharePoint Designer create the calendar request with Show As Free Time?

Leave a Reply

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