Shared Calendars with Google and/or CalDAV

29th January, 2009 by

Many people have asked me how best to share a calendar between colleagues, between friends, husband and wife, offices in different locations, and some other cases where coordinating schedules is useful.

One solution that many are turning to is Google Calendar, which is a fantastic solution. It offers many features, including the ability to subscribe to your calendars from desktop applications. If your software supports iCal, you can subscribe to your Google Calendar by clicking on the calendar under My Calendars, and choosing Settings. In the window that appears, make sure that the Calendar Details tab is selected. At the bottom, you will see several buttons, one of which displays “ical” – there is a button for both “public” and “private”, which will show only your public events or all events (both public and private). Copy and paste the URL from this button into your calendar application.

The disadvantage of iCal is that it is one-way – you can subscribe to updates from Google Calendar from your desktop calendar (Mozilla Sunbird, Mozilla Lightning, or Apple iCal, for some examples), but you cannot edit them remotely.

To solve this, Google has recently allowed CalDAV access. To use it, you will make use of an URL like https://www.google.com/calendar/dav/your@gmail.address/events – where your@gmail.address is your Gmail address. Using this link from WebCal-enabled applications like Mozilla Sunbird or Mozilla Lightning, you can both view and edit calendars shared via Google Calendar.

For many, this solution alone is excellent. A web-based viewer and editor (http://www.google.com/calendar) is available, as well as having the freedom to integrate it with local desktop calendars which may have other events that are not public.

One example of how you may wish to use this is to have your departmental calendar on Google Calendar, and then have personal events in your own local, non-shared calendar. This becomes very useful for coordinating a team while still having freedom to record your own calendar events.

The astute reader will have noticed a few possible downsides to the above solution. Firstly, each calendar must have a unique Gmail address associated with it, which could become a problem if you have a lot of calendars. Secondly, the calendar data is stored at Google. If you are concerned about security, backups, or just control, this can be an issue. Because I’m a particularly paranoid sort, I would like to keep my calendar data where I can see it and back it up as frequently as I would like.

To this end, we’ll turn to WebDAV on your WestHost account. We will set up basically the same thing as we accomplished with Google Calendar with respect to the ability to subscribe to a calendar in Mozilla Sunbird, Mozilla Lightning, or any other iCal or CalDAV compliant application. Remember that iCal is one-way, while CalDAV is multidirectional. You may also hear the terms WebCal and iCal through WebDAV – these are different names for the same thing, the read and write-capable calendar we’re calling CalDAV.

By rolling our own solution, we will gain direct access to the underlying calendar files for security or backup, and we’ll gain the ability to have as many calendars as we want without relying on the “one calendar per gmail address” approach. It also looks a bit more professional having the calendar at your own internet domain name; but the downside is that we’ll lose the very nice and convenient Google Calendar interface.

To begin, we will edit the file /etc/httpd/conf/httpd.conf. You may access this file using an FTP client, or by logging into your File Manager at http://www.yourdomain.com/fm/. Using the file manager, you can click the first slash above the file listing, and then click etc, and then httpd, then conf, and finally click the edit icon next to httpd.conf.

At the end of the file, you will add a section like:

<Directory /var/www/html/dav>
DAV on
</Directory>

You may change /var/www/html/dav to anything else you would like, so long as it’s not already in use by web content. For instance, you may prefer /var/www/html/calendars. Once you have selected the location that you would like, create the directory – using File Manager, you can browse to /var/www/html/ and use the Create Directory button to make the location where your calendar data will be stored.

Advanced users may also add basic password protection here. To do so, use something like this instead:

<Directory /var/www/html/dav>
DAV on


AuthType Basic
AuthName "WebDAV Storage"
require valid-user
AuthUserFile /etc/davpasswd
</Directory>

Save the contents of httpd.conf.

You must then create the password file /etc/davpasswd. This may be done in File Manager, or you may upload it via FTP. You will place one user-password combination per line – to generate the encrypted passwords, use this convenient tool: http://home.flash.net/cgi-bin/pw.pl

Just enter the username and password there, and copy and paste the line it generates into the file you will upload or save to /etc/davpasswd.

Next, you must restart the web server in your account. This may be done by logging into Site Manager at http://www.yourdomain.com/manager/ and using the “Restart” link, or advanced users may accomplish it via SSH with the command “/etc/init.d/httpd restart”. Note that if you have an error in the httpd.conf file, your web site will not be available – in this case, check over what you entered in the file to make sure it appears correct.

You have now accomplished everything you need to do in order to store calendars. The next step is to create some!

Your desktop calendar application can create a calendar by just providing the URL http://www.yourdomain.com/dav/mycalendar.ics, where www.yourdomain.com is your domain name and /dav/ is the location you chose to store your calendars, and of course mycalendar.ics is the name of the calendar you would like to create.

We’ll proceed with Mozilla Sunbird as an example. It is a free download located at http://www.mozilla.org/projects/calendar/sunbird/ and works very well. Mozilla also produces a version integrated with Mozilla Thunderbird 2.x, called Lightning. In the upcoming Thunderbird 3 release, Lightning will be built in.

Start up Sunbird. From the File menu, choose New Calendar. Next, choose “On the Network”, and in the “Location” box type in the URL to your new calendar, e.g. http://www.yourdomain.com/dav/mycalendar.ics. Note that mycalendar.ics does not currently exist – Sunbird will create it on your server automatically when you add the calendar. Leave the Format option set at iCalendar (ICS) – because you are accessing a DAV-enabled location, Sunbird will automatically connect it in read/write mode.

Click Next, and you can choose a display name and color for events from this calendar. Finally, click Finish. If you had set up password protection, you will be asked for your username and password before the calendar can be saved.

You can now create as many calendars as you would like, knowing that they’re stored safely in your WestHost account where they are backed up and secure. Each calendar you create is stored on the server as an iCal format file, which you can download for backup purposes and use directly in most calendar applications if ever needed.

(Visited 1 times, 1 visits today)