列出icloud日历时如何为每个请求获得相同的响应?

时间:2019-06-14 09:55:00

标签: calendar icloud webdav caldav propfind

我使用caldav request propfind从icloud列出日历,我能够获取日历集合,但是每次运行的输出都不同。   启用 calendar的 current-user-principal 属性丢失了一些时间,并且显示了一些时间,因为我的代码失败了。   我需要 calendar-enabled 属性来检查是否在移动设备上启用了日历。   在两次运行之间,我没有在日历级别和代码上进行任何更改。请采取任何解决方案。

这是请求方法

methodPropfind =(标题,身份验证,正文,网址,cb)->   选项=     方法:“ PROPFIND”     标头:标头     身份验证:身份验证     身体:身体     网址:url   http选项,cb   返回true

正文:

<?xml version='1.0' encoding='UTF-8'?>
<propfind xmlns="DAV:" xmlns:D="http://apple.com/ns/ical/">
  <prop>
    <displayname/>
    <C:getctag xmlns:C="http://calendarserver.org/ns/"/>
    <owner/>
    <D:calendar-color/>
    <D:calendar-order/>
    <current-user-privilege-set/>
    <invite xmlns:A="http://calendarserver.org/ns/"/>
    <D:calendar-enabled />
    <C:schedule-default-calendar-URL xmlns:C='urn:ietf:params:xml:ns:caldav'/>
  </prop>
</propfind>

标题:

Depth:1

网址  url是主体url。

我已将xml响应转换为javascript对象,这是我所获得的列表中的日历之一。

我希望每次运行都能获得“ ExpectedOutput”,但是有时我会得到“ NotExpectedOutput”。为什么不同?

NotExpectedOutput:

{ displayname: { _attributes: { xmlns: 'DAV:' }, _text: 'Family' },
  getctag:
   { _attributes: { xmlns: 'http://calendarserver.org/ns/' },
     _text: 'FT=-@RU=39505321-e02c-46a5-a9ba-544e5c3f0fac@S=678' },
  owner:
   { _attributes: { xmlns: 'DAV:' },
     href: { _text: '/1146333145/principal/' } },
  'calendar-color':
   { _attributes: { xmlns: 'http://apple.com/ns/ical/' },
     _text: '#FFCC00' },
  'calendar-order':
   { _attributes: { xmlns: 'http://apple.com/ns/ical/' },
     _text: '1001' },
  'current-user-privilege-set':
   { _attributes: { xmlns: 'DAV:' },
     privilege:
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] ] } }

ExpectedOutput

 { displayname: { _text: 'Family' },
  getctag:
   { _attributes: { xmlns: 'http://calendarserver.org/ns/' },
     _text: 'FT=-@RU=39505321-e02c-46a5-a9ba-544e5c3f0fac@S=678' },
  owner: { href: { _text: '/11463333145/principal/' } },
  'calendar-color':
   { _attributes:
      { xmlns: 'http://apple.com/ns/ical/',
        'symbolic-color': 'yellow' },
     _text: '#FFCC00' },
  'calendar-order':
   { _attributes: { xmlns: 'http://apple.com/ns/ical/' },
     _text: '1001' },
  'current-user-privilege-set':
   { privilege:
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] ] },
  'current-user-principal': { href: { _text: '/11463335145/principal/' } },
  'calendar-enabled':
   { _attributes: { xmlns: 'http://apple.com/ns/ical/' },
     _text: 'true' } }

0 个答案:

没有答案
相关问题