Sun Java System Calendar Server 6 2005Q4 Developer's Guide

Command: export

Purpose

Export events and todos from a calendar to a file.

Parameters

Table 7–9 export Parameters

Parameter  

Type  

Purpose  

Required  

Default  

calid

string 

A semicolon-separated list of calendar identifiers from which to export events and todos. The user must have read access to all calendars in the list. 

The calid can be supplied in two formats: 

  • string - calendar identifier

  • mailto:rfc822addr - An email address appended to “mailto:”. The address is mapped to a user with an LDAP lookup, and then the user’s de fault calendar ID is used. Returns: X-SICS-EMAIL and X-NSCP-CALPROPS-RELATIVE-CALID

Current user’s calid

content-out

string 

Content type for output file. One of the following: 

text/calendarx

text/xml

N/A 

dtend

Date Time string 

End time and date of the events and todos to export. A value of 0 means export all components from the start date to the latest date.

0

dtstart

Date Time string 

Start time and date of events and todos to export. A value of 0 means export all components from the earliest date to the end date.

0

id

unique identifier string (uid)

The session identifier. 

NULL

Description

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.

Range

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.

HTTP Post Examples

You must use this command with an HTTP POST. This is unlike other commands, which can be used with an HTTP GET.

Example 1

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

Example 2

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