Download ICS files from SharePoint calendars
The other day while playing with SharePoint modern Events web part with my colleague Francisca Peixoto we realized that it includes a feature to download an ICS file to then be added to an Outlook calendar.
This discovery also reminded me that I once started a project to provide this exact same functionality on classic SharePoint calendars but never finished it.
After spending a while searching for the code I finally found it, finished the project and I’m sharing it with all of you guys in this article.
Download ICS file from SharePoint calendar event manually
SharePoint has the possibility to generate ICS files from calendars since SharePoint 2007, however it never had this functionality available through the graphical user interface.
They only way to get the file is by using a structured URL in the following format.
- SITE_URL – The URL to the site where the calendar is hosted
- LIST_GUID – The unique identifier of your calendar list
- EVENT_ID – The identifier of the calendar event
Getting the LIST_GUID and the EVENT_ID is not straight forward for most users and with that in mind I decided to build a custom solution that adds a small download button on top of each event when the user hovers it. It also adds an extra field to the event detail with a direct link to the ICS file.
How to install the solution
This solution is provided as declarative Sand Box solution (read more about this type of solutions here) and it works on SharePoint 2013 and 2016 On Premises and SharePoint Online classic sites, this solution will not work on modern sites.
If you are using SharePoint Online to accomplish the steps bellow you will need to enable the custom scripts on your tenant, here you have the instructions on how to do it.
- Download the solution from here
- Extract it from the ZIP file
- On the root site of your site collection go to Settings Site Settings Solutions
- Upload and Activate the Solution
Once the activation process finishes the solution is ready to be used by all calendars of the site collection.
How to use the solution
To use this solution, you just need to open the calendar and over the item as exemplified in the animation below.
This solution supports the following views:
- Monthly view
- Weekly view
- Daily view
- Event detail view
How the solution works
The solution deploys a custom action on your site collection, it validates if you are visiting a SharePoint calendar and if you are it automatically gets the LIST_GUID and the EVENT_ID to build the link to download the ICS file.
As always, I made the solution available on GitHub and you are welcomed to contribute to improve it, due to the fact I lost the Visual Studio Project I’m sharing just the WSP files. Instructions on how to modify the solution will be provided in the repository.
Thanks to Justin Shands for the great article Generating an ICAL (.ICS) file from a SharePoint calendar list item, it was fundamental to build this solution.