Export events and todos from a calendar to a file.
Use this command to export events and todos from one or more specified calendars to a file. The contents of the file can later be imported to a calendar using the import command. The command creates a file called export.ics or export.xml, depending on the value of the content-out parameter.
If you do not specify either the starting or ending date, all events and todos in the calendars are added to the file. If you specify a starting and ending date, the command exports only events and todos in the calendars that fall within the time range. Specify starting and ending dates in UTC time, which is indicated by Z at the end of the date-time string.
You must use this command with an HTTP POST. This is unlike other commands, which can be used with an HTTP GET.
The following HTTP POST message exports all components of the calendars jdoe and john to an iCalendar file named export.ica:
POST /export.wcap?id=t95qm0n0es3bo35r &calid=jdoe;john &dtstart=0 &dtend=0 &content-out=text/calendar Content-type: multipart/form-data; boundary=-------------41091400621290 Content-Length: 47 --------------------- 41091400621290-- WinNT; U) Host: jdoe:12345 Accept: image/gif, image/x-xbitmap, image/jpeg,image/pjpeg,image/png */* Accept-Encoding: gzip Accept-Language: en Accept-Charset: iso-8859-1,*,utf-8
The following HTML generates a POST message using the export command, producing files in both iCalendar and XML formats:
<form METHOD=POST ENCTYPE="multipart/form-data" NAME="john.ics" ACTION="http://calendarserver:12345/export.wcap ?id=t9u9m0eh8x5pu9b&calid=jdoe;john&dtstart=0&dtend=0 &content-out=text/calendar"\> <ul\> <li\>Press Export ICAL Now:<input type="submit" value="Export ICAL now"\> </li\> </ul\> </form\> <form METHOD=POST ENCTYPE="multipart/form-data" NAME="john.xml" ACTION="http://calendarserver:12345/export.wcap ?id=t9u9m0eh8x5pu9b&calid=jdoe;john&dtstart=0 &dtend=0&content-out=text/xml"\> <ul\> <li\>Press Export XML Now:<input type="submit" value="Export XML now”\> </ul\> </form\>
This is the output generated:
HTTP/1.0 200 Date: Thu, 03 Jun 2002 22:15:52 GMT Content-type: text/calendar Content-disposition: attachment; filename="export.ics" Content-length: 7004 BEGIN:VCALENDAR METHOD:PUBLISH VERSION:6.0 BEGIN:VEVENT UID:tm-001 RECURRENCE-ID:20020519T010000Z DTSTAMP:20020603T221548Z SUMMARY:Calendar Staff DTSTART:20020518T170000Z DTEND:20020518T190000Z CREATED:20020603T024254Z LAST-MODIFIED:20020603T024254Z PRIORITY:1 SEQ:1 GEO:37.463581;-121.897606 DESC:This is the description for event with UID = tm-001 URL:http://calendarserver/susan?uid=tm-001 LOCATION:Green Conference Room STATUS:CONFIRMED TRANSP:OPAQUE END:VEVENT BEGIN:VEVENT UID:tm-001 RECURRENCE-ID:20020526T010000Z DTSTAMP:20020603T221548Z SUMMARY:Calendar Staff DTSTART:20020525T170000Z DTEND:20020525T190000Z CREATED:20020603T024254Z LAST-MODIFIED:20020603T024254Z PRIORITY:1 SEQ:1 GEO:37.463581;-121.897606 DESC:This is the description for event with UID = tm-001 URL:http://calendarserver/susan?uid=tm-001 LOCATION:Green Conference Room STATUS:CONFIRMED TRANSP:OPAQUE END:VEVENT END:VCALENDAR