Dev Hack Alert: Creating a Public ICS Feed

Users frequently want to share their Salesforce calendars with folks who aren’t in their Salesforce orgs. This is such a common business need, I wouldn’t be surprised if it is responsible for most of the calendar-syncing apps on the AppExchange!

Google Calendar provides good options for public sharing. There are lots of solutions on the AppExchange for syncing with Google, and once you’ve achieved the sync, you can use Google’s sharing options to create feeds that can be distributed publicly.

But what if we want a purely Salesforce option? Does Salesforce provide us tools to do this without syncing to a separate database?

But how did they actually do it? First, the Apex code in an unmanaged package such as the iCalendar Export app provides an immediate starting point – especially considering that you can take advantage of existing test classes (huzzah!). Out of the box, it just works on Events, but it can be modified to work with any object. iCalendar Export doesn’t create a feed, but instead generates an .ics file export from the Events object based on a date range entered by a user. This file can then be imported into iCal or other clients that support the .ics format.

Force.com sites allows the creation of public facing web sites based on Visualforce pages, so using this feature to publish an ICS feed is a logical approach. Add a simple Visualforce page, and this amazing DIY solution is complete!

Want to try it yourself? Of course you do. Check out the full blog post here, complete with code modification instructions. Thanks DayBack, for sharing this great idea with us!