Tuesday Dec 01, 2009

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.
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