import.wcap

Skip to end of metadata
Go to start of metadata

import.wcap

Purpose

Import events and todos in iCalendar format in to a calendar.

Parameters

import Parameters
Parameter Type Multi-valued?
Purpose Required Default
calid string N Identifier of a calendar to which to import events and todos. The calid is the value given by the server as X-NSCP-CALPROPS-RELATIVE-CALID N Current user's default calendar calid
content-in string N Content type of input data. Only text/calendar is supported. N text/calendar
dtend Date Time string in UTC
N 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.
N 0
dtstart Date Time string in UTC
N 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.
N 0
id unique identifier string N The session identifier. Required unless the calendar is public. Y 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 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 iCalendar (.ics) format.

Range

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.

Error Codes

If the operation is successful, the error number of 0 is appended to the error string. On failure, it returns the error code 77, BAD_IMPORT_ARGUMENTS. For a complete list of error codes, see Calendar Server WCAP 7.0 (WCAPbis) Error Codes.

Example

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

POST http://<calendarserver>:<port>/wcap//import.wcap?id=<session-id>&calid=/home/jdoe/calendar/&dtstart=0&dtend=0
Content-type: multipart/form-data;boundary=---------------------------33111928916708
Content-Length: 679
-----------------------------------33111928916708
Content-Disposition: form-data; name="file"; filename="/tmp/ical1.ics"
Content-Type: text/calendar

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>:<port>/wcap/import.wcap
        ?id=<session-id>
        &calid=/home/jdoe/calendar/
        &dtstart=0
        &dtend=0
        &content-in=text/calendar"\>
<ol\>
<li\>file to import:<input type="file" accept="text" name="file"\>
</li\>
 <li\>Press Import Now:<input type="submit" value="Import Now"\></li\>
 </ol\>
 </FORM\>
Labels:
caldavserver caldavserver Delete
wcap wcap Delete
wcapcmd wcapcmd Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. May 03, 2013

    I spent some time trying to make these examples work, and my problem was, as user "Chiu Chau" pointed out on the Oracle forums at [https://forums.oracle.com/forums/message.jspa?messageID=10977543], that in practice the uploaded-file field name (at least as of OCUCS 7u2) should be "file" and not "Upload". In this regard the HTML form example above and the POST HTTP message further above are wrong (and while we're at it, the indentations and a missing newline between the headers and the POST message are somewhat misleading too).

    Also it is possible to use HTTP Basic Auth instead of pre-requested session ID, which simplifies scripting greatly - by using httpauth=1 instead of id=xxx in the HTTP request-URL parameters. Kudos for this piece of information go to the forums user "arnaudq".

    1. Jun 28, 2013

      Hi JimKlimov,

      I made updates to this page based on your comments.

      Thanks,

      Joe

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Oracle community and they might not be employed or in any way formally affiliated with Oracle. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Oracle nor any other party necessarily agrees with them.