0
<C:calendar-query xmlns:D='DAV:'
                 xmlns:C='urn:ietf:params:xml:ns:caldav'>
                                     <D:prop>
                                       <D:getetag/>
                                <C:calendar-timezone xmlns:D='DAV:' xmlns:C='urn:ietf:params:xml:ns:caldav'></C:calendar-timezone>
                                       <C:calendar-data>
                                        <C:expand start='20170116T031008Z'
                                                end='20170131T031008Z'/>
                                         <C:comp name='VCALENDAR'>
                                           <C:prop name='VERSION'/>
                                           <C:comp name='VEVENT'>
                                             <C:prop name='SUMMARY'/>
                                             <C:prop name='DESCRIPTION'/>
                                             <C:prop name='STATUS'/>
                                              <C:prop name='TRANSP'/>
                                               <C:prop name='ATTENDEE'/>
                                             <C:prop name='UID'/>
                                             <C:prop name='DTSTART'/>
                                             <C:prop name='DTEND'/>
                                             <C:prop name='DURATION'/>
                                             <C:prop name='RRULE'/>
                                             <C:prop name='RDATE'/>
                                             <C:prop name='EXRULE'/>
                                             <C:prop name='EXDATE'/>
                                             <C:prop name='RECURRENCE-ID'/>
                                           </C:comp>
                                         </C:comp>
                                       </C:calendar-data>
                                     </D:prop>
                                     <C:filter>
       <C:comp-filter name='VCALENDAR'>
         <C:comp-filter name='VEVENT'>
           <C:time-range start='20170116T031008Z'
                         end='20170131T031008Z'/>
         </C:comp-filter>
       </C:comp-filter>
     </C:filter>
                                   </C:calendar-query>

Hi, I am using caldav extension to retrieve busy time(by time range) from iCloud calendar. I am using a calendar query with a "REPORT" method. It gives XML having busy time for all calendars within the time range. But sometimes it doesn't give busy time for a particular calendar. Suppose I am having 3 calendars so, sometimes it gives busy times for all 3 calendars and sometimes for only 2 calendars(by leaving same calendar). If I retry for busy then it gives busy time after 7-8 retry. But Sometimes it doesn't give even after 7-8 retries. What is happening?

Priyank Kotiyal
  • 241
  • 2
  • 13

1 Answers1

0

I didn't find a reason that why it is happening. But I have changed the process of busy time retrieval so that it brings busy time from all calendars. Previously I was hitting this request to URL - https://PXX-caldav.icloud.com/token/calendars which is not working for some specific calendars consistently.

New process-:

STEP 1: Hit the same request at https://PXX-caldav.icloud.com/token/calendars/calendarId this gives you urls of all the events within the time range from a calendar(for those as well for which I wast not able to retrieve busy time). Here, it gives events from calendar with id calendarId(your calendar's Id). It gives me xml in something following xml -:

<href>/token/calendars/calendarId/event1Id.ics</href>
<href>/token/calendars/calendarId/event2Id.ics</href>
<href>/token/calendars/calendarId/event3Id.ics</href>

Now you have to parse the xml to retrieve all the urls.

STEP2: After that you have all the urls, you have to hit single, multi-get request having these urls, at same url to retrieve data from these url and show them as busy time.

URL -: https://PXX-caldav.icloud.com/token/calendars/calendarId
Request -:
<C:calendar-multiget xmlns:d='DAV:' xmlns:C='urn:ietf:params:xml:ns:caldav'>
                                            <d:prop>
                                                <d:getetag />
                                                 <C:calendar-data>
                                                    <C:comp name='VCALENDAR'>
                                                        <C:prop name='VERSION'/>
                                                        <C:comp name='VEVENT'>
                                                            <C:prop name='SUMMARY'/>
                                                            <C:prop name='DESCRIPTION'/>
                                                            <C:prop name='STATUS'/>
                                                            <C:prop name='TRANSP'/>
                                                            <C:prop name='ATTENDEE'/>
                                                            <C:prop name='UID'/>
                                                            <C:prop name='DTSTART'/>
                                                            <C:prop name='DTEND'/>
                                                            <C:prop name='DURATION'/>
                                                            <C:prop name='RRULE'/>
                                                            <C:prop name='RDATE'/>
                                                            <C:prop name='EXRULE'/>
                                                            <C:prop name='EXDATE'/>
                                                            <C:prop name='RECURRENCE-ID'/>
                                                        </C:comp>
                                                    </C:comp>
                                                </C:calendar-data>
                                            </d:prop><d:href>/token/calendars/calendarId/event1Id.ics</d:href>
    <d:href>/token/calendars/calendarId/event2Id.ics</d:href>
    <d:href>/token/calendars/calendarId/event3Id.ics</d:href>
                                        </C:calendar-multiget>

It gives you data for all three events. This helps you to retrieve busy time from every calendar. If you have to retrieve events from multiple calendars then you have to repeat these two steps for every calendar.

Priyank Kotiyal
  • 241
  • 2
  • 13