简体   繁体   English

iCloud 的 CalDav 客户端:MKCOL 失败,412 前提条件失败

[英]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.我在我们的系统上实现了一个 CalDav 客户端,它工作起来很有吸引力。 Now I have some problems with creating new calendars on iCloud.现在我在 iCloud 上创建新日历时遇到了一些问题。 Maybe some of you know how I can fix this.也许你们中的一些人知道我如何解决这个问题。

Currently I get a 412 Error.目前我收到 412 错误。

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. URL 是我的原则(我当然改变了它)和日历资源的随机生成的 UUID。

Maybe somebody spots any errors?也许有人发现任何错误? Used to work fine 6 months ago.过去 6 个月前工作正常。

Thank you very much!非常感谢!

While there seems to be a mapping bug on the caldav.icloud.com endpoint (filed that as Radar 46258347 if you want to refer), you are not supposed to hit a /calendars URL on this endpoint in the first place.虽然caldav.icloud.com端点上似乎存在映射错误(如果您想参考,则将其归档为 Radar 46258347),但您首先应该在此端点上点击/calendars URL。

You only use caldav.icloud.com to discover the principal resource (representing the user/account).您仅使用caldav.icloud.com来发现主体资源(代表用户/帐户)。 This contains the actual partition hosting the caldav server for your account, it looks like:这包含为您的帐户托管 caldav 服务器的实际分区,它看起来像:

https://pXX-caldav.icloud.com/asdfjasdjkjfd/calendars/

Those endpoint still seem to work just fine (just tried).这些端点似乎仍然可以正常工作(刚刚尝试过)。

So how do you get from caldav.icloud.com to the actual CalDAV server?那么如何从caldav.icloud.com到实际的 CalDAV 服务器呢? You need to retrieve the calendar-home-set property of the principal.您需要检索主体的calendar-home-set属性。

The whole process is described in the CalDAV RFC or in this nice guide: http://sabre.io/dav/building-a-caldav-client/#discovery . CalDAV RFC 或这个不错的指南中描述了整个过程: http : //sabre.io/dav/building-a-caldav-client/#discovery

如果您使用https://pXX-caldav.icloud.com/123456789/calendars/new-calendar-name-or-href/进行MKCOL请求,那么您将获得201 CREATED状态,您的新收藏的 href 将是pXX-caldav.icloud.com/123456789/calendars/new-calendar-name-or-href/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM