What's wrong with this iCalendar event?

Posted by rihallix on Stack Overflow See other posts from Stack Overflow or by rihallix
Published on 2011-11-29T17:47:36Z Indexed on 2011/11/29 17:50 UTC
Read the original article Hit count: 274

Filed under:

I'm generating iCalendar events using PHP. They pass the validation checkers but won't add to Google Calendar or iCalendar. Help - what am I doing wrong?

When I attempt to import I get "iCal can't read this calendar file. No events have been added to your calendar. Google just appears to import the calendar but it's not there.

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Foobar Name//NONSGML Foobar Name//EN

BEGIN:VEVENT
UID:20111129T103025-268Z@foobar
DTSTAMP:20111210T103025Z
DTSTART:20111210T210000Z
DTEND:20111210T230000Z
TRANSP: TRANSPARENT
SUMMARY:Foobar - Book Fair - text
DESCRIPTION: Foobar: Book Fair - text
END:VEVENT

END:VCALENDAR

Should I addslashes or not write colons in my summary or description text?

Here are the headers I'm writing out...

header("Content-Type: text/Calendar");
header('Content-Disposition: inline; filename="calendar.ics"');
echo "BEGIN:VCALENDAR</br>";
echo "VERSION:2.0</br>";
echo "PRODID:-//$orgname//NONSGML $orgname//EN</br>";
echo "METHOD:REQUEST</p>"; // required by Outlook

The file I'm generating has the extension .php (not .ics).

Thanks for any insight into what I might be doing wrong.

rihallix (PHP5.2 / Windows)

© Stack Overflow or respective owner

Related posts about icalendar