I am listing calendars from icloud using caldav request propfind, I am able to get the calendar collection, but the output differs for each run. The calendar-enabled and current-user-principal properties are missing some time and some time it shows, because of theat my code is failing. I need calendar-enabled property to check whether the calendar is enabled on mobile or not. I did not changed anything at calendar level and at code between the runs. Any solution please.
This is the request method
methodPropfind = (headers, auth, body, url, cb) -> options = method: 'PROPFIND' headers: headers auth: auth body: body url: url http options, cb return true
body:
<?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>
Header:
Depth:1
Url url is principal url.
I have converted xml response to javascript object, and this is one of the calendar from list which I am getting.
I am expecting "ExpectedOutput" for every run, but some time I am getting "NotExpectedOutput". Why it is differing?
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' } }