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

Command: import

Purpose

Import events and todos from a file to a calendar.

Parameters

Table 7–23 import Parameters

Parameter  

Type  

Purpose  

Required  

Default  

appid

string 

A runtime parameter that is not stored in the database. This parameter specifies which application is making the request. ENS uses this parameter to determine which X-Tokens to return. Does not affect WCAP command output. 

For more information on the ENS X-Tokens, see the Sun Java System Communications Services 6 2005Q4 Event Notification Service Guide.

N/A 

calid

string 

Identifier of a calendar to which to import event. 

N/A 

content-in

string 

Content type of input data. One of the following values:text/calendartext/xml

N/A 

dtend

Date Time string 

End time and date of the events and todos to import. 

A value of 0 means import all components from the start date to the last date in the file.

0

dtstart

Date Time string 

Start time and date of events and todos to import. 

A value of 0 means import all components from the earliest date in the file to the end date.

0

id

unique identifier string 

The session identifier. Required unless the calendar is public. 

N/A 

Description

Use this command to import to the specified calendar events and todos that have previously been exported to a file using the export command. You must specify the file’s MIME content type in the content-in parameter.

If you do not specify either the starting or ending date, or you pass in 0 as the value for dtstart and dtend, the command adds all events and todos in the file to the specified calendar. If you specify a starting and ending date, the command imports only events and todos in the file that fall within the time range. Specify starting and ending dates in UTC time, which is indicated by the Z at the end of the date-time string.

You must use this command with an HTTP POST message, unlike other commands that can be used with an HTTP GET message. You attach the file containing the exported events and todos to the POST message. This file must be in either iCalendar (.ics) or XML (.xml) format.

Example

The following POST message imports the attached iCalendar file to the calendar jdoe using the import command. The session ID is required:

POST /import.wcap?id=t95qm0n0es3bo35r
  &calid=jdoe&dtstart=0&dtend=0
Content-type: multipart/form-data;
boundary=---------------------------33111928916708
 Content-Length: 679
 -----------------------------------33111928916708
 Content-Disposition: form-data; name="Upload";
filename="C:\\TEMP\\ical1.ics"
 BEGIN:VCALENDAR
 BEGIN:VEVENT
 DTSTART:20020105T100000Z
DTEND:20020105T110000Z
 DTSTAMP:20010104T120020Z
 CREATED:20010105T110000Z
 LAST-MODIFIED:20010104T120020Z
 SUMMARY:Weekly QA Meeting
 UID:random-uid001
 END:VEVENT
 BEGIN:VEVENT
 DTSTART:20020106T100000
 DTEND:20020106T110000
DTSTAMP:20010104T120020
 CREATED:20010105T110000Z
 LAST-MODIFIED:20010104T120020Z
 SUMMARY:Weekly QA Meeting 2
 UID:random-uid002
 END:VEVENT
 END:VCALENDAR
---------------------------------33111928916708--

The following HTML form creates such a POST message, attaching a file that the user specifies:

<FORM METHOD=POST ENCTYPE="multipart/form-data"
ACTION="http://calendarserver:12345/import.wcap
        ?id=t95qm0n0es3bo35r
        &calid=jdoe
        &dtstart=0
        &dtend=0
        &content-in=text/calendar"\>
<ol\>
<li\>file to import:<input type="file" accept="text" name="Upload"\>
</li\>
 <li\>Press Import Now:<input type="submit" value="Import Now"\></li\>
 </ol\>
 </FORM\>