Let users open a ics file on a SharePoint calendar meeting

October 27th, 2015 | Posted by Marijn in collaboration | enduser | events | productivity | quick tip | sharepoint

When a key user asked me a way to better integrate calendar meetings into the daily lives of their users,  I showed the default ways of working with the calendar: Simply connect the calendar to your Outlook and you can open up the items.

But, she replied, what about our portal site? We just have a specific session every few weeks, ment for a specific audience. We don’t want all our 2000 employees having to open the calendar in Outlook.

A quick search online (insert your own bing-google joke here) brought me to the SharePointProMag site where Dan Holme had this amazing suggestion. This post dates back from 2007, but it still works in SharePoint 2013.

The idea is to build a calculated column that calls the “owssvrs.dll”. This file was already present in FrontPage many years ago, the functionalities make up the primary features of SharePoint, namely list creation, deletion, and authoring. It creates a virtual table that stores data and metadata and forms an abstraction on top of the database. With this, it allows the user to manage tabular data in a Web site environment. As part of the SharePoint module, the owssvr.dll file can be used directly from the browser. The user can utilize it programmatically through a client API. And that is exactly what we do here.

Calculated column

So, to start, we need to create the column. Do this via list settings, not via the ribbon directly, because we will need something extra. Add a new column to the list (calendar) and use the Calculated Column type.

Enter the following formula:

  =”http:// yoursitename/_vti_bin/owssvr.dll?CS=109&Cmd=Display&List=ListID&CacheControl=1&ID=”&ID&”&Using=event.ics”

Change ‘yoursitename’ with the name of the site you currently are. Change ListID with the ID of the list. You can find that listID in the url of the page where you are now (that is why you need to do this via list settings).

Example:

https://yoursite/_layouts/15/fldNew.aspx?List=%7B20552501%2DA7A7%2D4811%2DAA2E%2DCF26DCD99157%7D

If you copy this link to the browser, you will see the calendar item appear as an Outlook calendar item which you can now directly save.

Clickable link

Now, you can do all kinds of tricks to make the link actually clickable. First thing that comes to mind is to create a html link wrapper around it. We need to do 2 things for that:

  1. change the “data type returned” from the calculated column to Number (little trick to make calculated columns become clickable links)
  2. change the formula of the calculated column to:

=”<a href=’http://yoursitename/_vti_bin/owssvr.dll?CS=109&Cmd=Display&List=ListID&CacheControl=1&ID=”&ID&”&Using=event.ics’>open in Outlook</a>”

This gives you following result:

Calculated column in the calendar

Calculated column in the calendar

Calendar displayform

Problem we have is that in the displayform (when you open the item itself in SharePoint), the link is very ugly.

There are various ways to solve this (for example use javascript on the displayform to re-parse the page) but as this post is for key / end users I want to use an easy solution: workflow.

This is something that you can do with SharePoint Designer: create a new workflow on the calendar that runs every time you change / add the calendar item.

The workflow has 3 parts:

  1. Create a new column in SharePoint of type “Hyperlink”
  2. Open SharePoint Designer (or the workflow tool of your choice)
  3. Create a new local variable (in the workflow), called “url” that is of type ‘string’
  4. Add an action “Set Workflow Variable” where you set the new “url” variable to this value:
    • http:// yoursitename/_vti_bin/owssvr.dll?CS=109&Cmd=Display&List=ListID&CacheControl=1&ID=”&ID&”&Using=event.ics, add to outlook
    • Change the “&ID” to the lookup ‘Current item: ID’ (to make sure it uses this item to make a link)
  5. add an action “Set field in current item” where you set the Hyperlink field from step 1 to your workflow variable ‘url’
  6. Save and publish the workflow. Create a new item and let the workflow run.

 

The end result should look like this:

End result in SharePoint calendar item

End result in SharePoint calendar item

 

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

6 Responses



Leave a Reply

%d bloggers like this: