CalDav Client for iCloud: MKCOL fails with 412 precondition failed

I need help. I implemented a CalDav Client on our System and it worked like a charm. Now I have some problems with creating new calendars on iCloud. Maybe some of you know how I can fix this.

Currently I get a 412 Error.

Headers:


"Depth: 1" 
"Content-Type: application/xml; charset=UTF-8" 
"User-Agent: DAVKit/4.0.1 (730); CalendarStore/4.0.1 (973); iCal/4.0.1 (1374); Mac OS X/10.6.2 (10C540)"



Request:

MKCOL


Body:

<D:mkcol xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> 
  <D:set> 
    <D:prop> 
      <D:resourcetype> 
        <D:collection/> 
        <C:calendar-collection/> 
      </D:resourcetype>
        <D:displayname>some name</D:displayname> 
    </D:prop> 
  </D:set> 
</D:mkcol>

URL:

https://caldav.icloud.com/1722222111/calendars/64DA8FE9D95A40E4B83A45B47DEC6C53/


The URL ist my Principle (I changed it of course) and a randomly generated UUID for the calendar resource.

Maybe somebody spots any errors? Used to work fine 6 months ago.

Thank you very much!

Replies

Answer from Stackoverflow is the solution:


If you use

https://caldav.icloud.com/1722222111/new-calendar-name-or-href/
for making
MKCOL
request, then you will get
201 CREATED
status and the href of your new collection will be
https://caldav.icloud.com/1722222111/calendars/new-calendar-name-or-href/

so remove

calendars/
from your original url