subcollections under calendar collections

To synchronize a calendar collection, clients typically issue a PROPFIND with Depth = 1 on the calendar collection, asking for the DAV:getetag property.

>> Request <<
 

PROPFIND /dav/home/arnaudq@example.com/calendar/ HTTP/1.1
host: localhost:8080
depth: 1
content-type: text/xml

<?xml version="1.0" encoding="utf-8"?>
<x0:propfind xmlns:x0="DAV:">
 <x0:prop>
  <x0:getetag/>
 </x0:prop>
</x0:propfind>

>> Response <<

HTTP/1.1 207 Multi-Status
Content-Type: application/xml; charset="utf-8"

<?xml version="1.0" encoding="UTF-8"?><D:multistatus xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
<D:response>
<D:href>/dav/home/arnaudq@example.com/calendar/</D:href>
<D:propstat>
<D:prop>
<D:getetag/>
</D:prop>
<D:status>HTTP/1.1 404 Not Found</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>/dav/home/arnaudq@example.com/calendar/dd5b7d18-837b-2249-995e-765d5fc240e9.ics</D:href>
<D:propstat>
<D:prop>
<D:getetag>"1259672377000.2"</D:getetag>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>/dav/home/arnaudq@example.com/calendar/c14358f8-9b94-6e44-af3a-d728d336800b.ics</D:href>
<D:propstat>
<D:prop>
<D:getetag>"1259672497000.2"</D:getetag>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>

All resources directly under the calendar collection will be returned.

Among those, the client should be prepared to see WebDAV collections. While the CalDAV specification forbids calendar collections to contain other calendar collections (at any depth), having a basic WebDAV collection under a calendar collection is legal. To filter them out, a client can either rely on the DAV:href of each returned resource (collection URIs end with a "/" character), or ask for the DAV:resourcetype property:

>> Request <<
 

PROPFIND /dav/home/arnaudq@example.com/calendar/ HTTP/1.1
host: localhost:8080
depth: 1
content-type: text/xml

<?xml version="1.0" encoding="utf-8"?>
<x0:propfind xmlns:x0="DAV:">
 <x0:prop>
  <x0:getetag/>
  <x0:resourcetype/>
 </x0:prop>
</x0:propfind>

>> Response <<

HTTP/1.1 207 Multi-Status
Content-Type: application/xml; charset="utf-8"

<?xml version="1.0" encoding="UTF-8"?><D:multistatus xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:M="urn:ietf:params:xml:ns:carddav">
<D:response>
<D:href>/dav/home/arnaudq@example.com/calendar/</D:href>
<D:propstat>
<D:prop>
<D:resourcetype><C:calendar/><D:collection/></D:resourcetype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
<D:propstat>
<D:prop>
<D:getetag/>
</D:prop>
<D:status>HTTP/1.1 404 Not Found</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>/dav/home/arnaudq@example.com/calendar/dd5b7d18-837b-2249-995e-765d5fc240e9.ics</D:href>
<D:propstat>
<D:prop>
<D:getetag>"1259672377000.2"</D:getetag>
<D:resourcetype></D:resourcetype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>/dav/home/arnaudq@example.com/calendar/attachments/</D:href>
<D:propstat>
<D:prop>
<D:resourcetype><D:collection/></D:resourcetype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
<D:propstat>
<D:prop>
<D:getetag/>
</D:prop>
<D:status>HTTP/1.1 404 Not Found</D:status>
</D:propstat>
</D:response>
</D:multistatus>
In the example above, the calendar collection contains an "attachments" subcollection. CalDAV clients can simply ignore it, based on the value of its DAV:resourcetype property which is not empty.
Comments:

I don't think you can rely on collection URIs to end with a slash; you really have to check DAV:resourcetype to be sure.

Posted by Julian Reschke on December 01, 2009 at 08:48 AM CET #

Oops.

And furthermore, DAV:resourcetype not being empty does \*not\* mean it is a collection! You really have to check for the child element DAV:collection.

Posted by Julian Reschke on December 01, 2009 at 08:55 AM CET #

About the ending slash, it is indeed a SHOULD and not a MUST for WebDAV servers. Never noticed that.

Posted by Arnaud Quillaud on December 02, 2009 at 09:06 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
About

arnaudq

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Bookmarks