Apple’s iCal and iCal/vCal format

by david on July 6, 2004

We’ve started building our newest software package. One of the features I would like to include is the ability to access a calendar of events. It seems like it should be very straight forward. Just publish a "standards-based" format and then subscribe to it using a viewer. Well it almost works

We are a mostly Mac OS X based shop. I figured that a combination of iCal or Mozilla Calendar (once there is a version for Firefox 0.9.x for Mac OS X) or PHPiCalendar would allow me to generate an .ics file and subscribe to the URI (I also looked at using iWebCal but I just couldn’t get version 1.1 to run on my Mac and EventSherpa for my PC). This would provide a cross-platform and web-based solution to viewing generated calendar data.

I am able to generate a stream using Perl, Python, PHP or Java, but I just can’t seem to get iCal 1.5.2 to see any of the events. All of the other tools have absolutely no problem, which confuses me. This should be really straight forward, however it is causing me no end of grief, I am starting to wonder if it is a bug in iCal?

BEGIN:VCALENDAR
VERSION:2.0
NAME:David Crow
X-WR-CALNAME:David Crow
X-WR-TIMEZONE:Canada/Eastern
PRODID:-//David Crow//NONSGML iCalendar Template//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
UID:20040704T131610Z-2@cornea.local
URL;VALUE=URI:http://davidcrow.ca/
SUMMARY:Test Calendar Posting
DTSTART;TZID=US-Eastern;VALUE=DATE-TIME:20040704T131610Z
DTEND;TZID=US-Eastern;VALUE=DATE-TIME:20040705T133110Z
ORGANIZER;CN=<a href="http://davidcrow.ca/">david</a>
END:VEVENT
BEGIN:VEVENT
UID:20040705T110236Z-1@cornea.local
DTSTAMP:20040705T0900Z
DTSTART:20040705T110200Z
DTEND:20040706T111700Z
SUMMARY:Welcome to Canada
CLASS:PUBLIC
CATEGORIES:BUSINESS,HUMAN RESOURCES
TRANSP:TRANSPARENT
END:VEVENT
BEGIN:VEVENT
UID:20040706T130000Z-123402@host.com
DTSTAMP:20040706T1300Z
DTSTART:20040706T163000Z
DTEND:20040707T010000Z
SUMMARY:Laurel is in sensitivity awareness class.
CLASS:PUBLIC
CATEGORIES:BUSINESS,HUMAN RESOURCES
TRANSP:TRANSPARENT
END:VEVENT
BEGIN:VEVENT
UID:20040705T131610Z-2@cornea.local
DTSTAMP:20040705T1300Z
DTSTART:20040705T163000Z
DTEND:20040707T010000Z
SUMMARY:David Rocks
CLASS:PUBLIC
CATEGORIES:BUSINESS,HUMAN RESOURCES
TRANSP:TRANSPARENT
END:VEVENT
BEGIN:VEVENT
UID:20040707T131610Z-3@cornea.local
DTSTAMP:20040708T0800Z
DTSTART:20040708T093000Z
DTEND:20040708T103000Z
SUMMARY:Test Calendar Posting
CLASS:PUBLIC
CATEGORIES:BUSINESS,HUMAN RESOURCES
END:VEVENT
END:VCALENDAR

iCal 1.5.2 is empty when importing this file. It reports that a URI that generates a "This calendar file is empty. No new events have been added to your iCal calendars."

iCal Error Dialog: This calendar file is empty. No new events have been added to your iCal calendars.

The other tools have no problems reading this file. I have saved a calendar from iCal and I am now adding different pieces of an .ics file that has been generated and successfully imported into iCal. Though what works and what doesn’t seems to be arbitrary, i.e. I am just guessing at the changes that matter.

The iCal2RDF converter has no trouble creating a valid RDF file from the pasted in iCal format. However, I don’t seem to be able to read the RDFiCal format in Shrook or Bloglines (though it validates using the W3 RDF Validator). I am starting to wonder if it might be easier/quicker to just export to RSS or other XML format and convert this to iCal format (it seems that I am not a lone in this camp Marc Cantor and Ray Ozzie have both suggested this previously). There are a bunch of cool tools to help automate this process:

On a related note, none of these tools support the VJOURNAL format specified in the iCalendar format. It would be great to use iCal to view my blog subscriptions without having to resort to using a VEVENT for each blog entry.

Popularity: 11% [?]

  • David Crow

    George, you hit it on the head, iCal is really picky about the extra spaces in the code. I had to make sure to trim any extra white spaces.

  • George Paci

    Warning: horribly off-topic



    Sorry, but I couldn&#039;t find your email anywhere. This is in response to your July 6, 2004 posting about problems with iCal.



    I noticed that your vCalendar text, as it appeared on the site, had trailing spaces on some begin/end lines. When I fed it to iCal, it didn&#039;t like that at all, and essentially ignored all events that had the problem.



    This pickiness may be the entire problem. Please let me know if this was helpful.

  • David Crow

    It looks like the error is with the iCal parser and the extra space after each &lt;pre&gt;END:VEVENT&nbsp;&lt;/pre&gt; as Olivier suggests. I wish that iCal was a little more liberal in parsing. This seems to be a common debate for RDF, RSS and Atom feed parsing.

  • bex

    Actually I found the error. The ics files are autogenerated by perl code that parses the pub 509 html from the IRS. There is one entry that is irregular and was resulting in a date of 20040000. This caused the entire month of January to be unhappy, only in Month display mode. All other months and display modes were ok. I corrected it and the world is good!



    As an aside: Does anyone find this idea useful?



    An intermediary that sits between your ical and a subscribed calendar and edits it. Here are three examples uses that I have come up with (I don&#039;t do all of these personally):



    1 - Eliminate certain holidays in a calendar (i.e. eliminate Labor Day from the US Holidays calendar because I must labor on that day. Or, eliminate certain holidays from a religious calendar because I don&#039;t celebrate them.



    2 - Eliminate all &quot;away&quot; games from a sports calendar because I only care about the team enough to follow them at home (or I just want a calendar of season ticket opps).



    3 - In the case of my Tax calendars, one of them provides info on both Payroll and Nonpayroll based withholdings. I only care about payroll based withholdings, so I scrub the others out.



    I have this running personally, and am not sure whether I should clean up for release.



    comments?



    PS: To David Crow: I apologize for hijacking your comments section of your blog like this. Please delete this post with my apologies if it is inappropriate. While I am a very seasoned internet user, I really do not follow the blog scene and so I am less aware of the netiquette.

  • Olivier Gutknecht

    Do you have any online example of such a faulty calendar file, bex ? The iCalendar RFC is quite complex, and it&#039;s easy to make a minor mistake.

  • bex

    I have run into a similar problem. Some homebrew ics files appear to display all events except those occurring in January 2004 in iCal. Oddly, they prevent all calendar&#039;s events from showing in that month. If you drill down to the day or week view, the events are there (they are all all-day events). If you deselect this calendar, then the other calendar&#039;s events will reappear. But only until you deselect/select them.



    I can find nothing different about the way I generated the January versus the other month events. Have you found out more about this problem on your end?



    danke

  • David Crow

    I could have sworn that NAME: was part of the spec. Thanks Tim, you are correct that it is not in there at all.



    I&#039;ll expose the .ics tonight. It is running on a development server which is behind the firewall. Either I&#039;ll promote to test, or just copy the file up.

  • Tim

    I&#039;ve posted a draft (note: version 00 so there will be some typos) on some guidelines for XML and iCalendar use.. this is an individual draft, but if you decide to look into XML and iCal I&#039;d like to hear your opinions.



    <a href="http://www.ietf.org/internet-drafts/draft-hare-xcalendar-00.txt

    " target="_blank"><a href="http://www.ietf.org/internet-drafts/draft-hare-xc..." target="_blank">http://www.ietf.org/internet-drafts/draft-hare-xc...

    One thing I saw in your file that isn&#039;t in the standard (RFC2445) is the NAME: property of VCALENDAR. Not sure if that causes a problem in iCal but it definitely seems non-stanard-compliant

  • Olivier Gutknecht

    It basically works for me in iCal 1.5.2 too (at least for two events). For the three others, there are some problems in the ICS pasted here, that is some of the &quot;BEGIN:EVENT&quot; / &quot;END:EVENT&quot; like do have an extra space after the EVENT string, which is sufficient to have them not recognized as a VEVENT component (the iCal parser seems to be ultra-strict here). This can be also due to a problem when pasting the ics content here, an URL to the actual file would be necessary to have a definitive advice on that.

  • Libby Miller

    Interesting - it works for me with ical 1.5.2 v637.

  • Matthias Cavigelli

    Maybe these two links will help you. I think it&#039;s a quite known problem.



    <a href="http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=c638o7%24ln32%40ripley.netscape.com&rnum=5&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26q%3DApple%2BiCal%2Bgroup%253Anetscape.public.mozilla.calendar.*%26btnG%3DSearch%26meta%3Dgroup%253Dnetscape.public.mozilla.calendar.*

    " target="_blank"><a href="http://groups.google.com/groups?hl=en&lr=&ie=UTF-..." target="_blank">http://groups.google.com/groups?hl=en&lr=&ie=UTF-...

    <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=179985

    " target="_blank"><a href="http://bugzilla.mozilla.org/show_bug.cgi?id=179985

    " target="_blank">http://bugzilla.mozilla.org/show_bug.cgi?id=179985

blog comments powered by Disqus

Previous post:

Next post:

Get Adobe Flash playerPlugin by wpburn.com wordpress themes