Javascript to trigger Connect to Outlook feature in SharePoint 2013

For usability, you may need to include buttons for users to download SharePoint calendar instance to MS Outlook in your custom application page. Adding this custom button, they do not need to access to the calendar page and hit on the SharePoint Ribbon button.

To achieve this function, firstly, you need to know how to mock the original Connect to Outlook button javascript.

In SharePoint init.js file, there exists a javascript function as shown

[javascript]

#

function ExportHailStorm(type, weburl, guid, webname, listname, viewurl, passport, listrooturl, folderurl, folderid) {</span>

#

[/javascript]

The following shows a sample on how to call this javascript via HTML button.

[html]

<input onclick="javascript:ExportHailStorm(
‘calendar’,
‘http://www.ahcheng.com/team’,
‘{2fa3820c-c739-4ec4-b3b3-23fc9c1ba093}’,
‘Team Site1’,
‘Calendar’,
‘/team/Lists/Calendar’,
”,
‘/team/Lists/Calendar’);return false;" type="button" value="Download Calendar"/>

[/html]

With this, you can setup multiple download buttons for different calendar instances into your custom place.

Connect to Outlook Javascript Button

Leave a Reply

Your email address will not be published. Required fields are marked *