3

I used to request caldav servers to give all defined calendars for a given user. That works with fruux/ownCloud(Sabre) and also GCalendar the classic method. The request is this:

method: PROPFIND  headers:Depth: 1  
urlstr:https://www.google.com/calendar/dav/{theUserName}@gmail.com/  
contentType:application/xml  
content:
<d:propfind xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/" xmlns:c="urn:ietf:params:xml:ns:caldav">  
  <d:prop>  
    <d:resourcetype />  
    <d:displayname />  
    <cs:getctag />  
    <c:supported-calendar-component-set />  
  </d:prop>  
</d:propfind>  

Moving to Google OAuth2 has different calls, the ulrstr: would something like https://apidata.googleusercontent.com/caldav/v2/{calid}/user
Here the 'calid' has to be a specific calendar [1] There iis said:

Where calid should be replaced by the "calendar ID" of the calendar to be accessed

The intension is to get all calendars for a user's account! So those calls will NOT help.

Any suggestion how to get them in the Google/CalDAV/V2 world?

Günter

See also: [1] https://developers.google.com/google-apps/calendar/caldav/v2/guide

jmacagno
  • 517
  • 3
  • 9
gNeandr
  • 381
  • 1
  • 4
  • 14
  • 2
    Solved, see here [link](https://code.google.com/p/google-caldav-issues/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary&groupby=&sort=&id=71) – gNeandr Aug 29 '13 at 10:40

1 Answers1

0

The link in the answer's comment is broken. So I wrote a working answer here.

  1. Find current user's principal using PROPFIND.
PROPFIND https://apidata.googleusercontent.com/caldav/v2

<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:">
    <D:prop>
        <D:current-user-principal/>
    </D:prop>
</D:propfind>

2.PROPFIND calendar-home-set with the principal URL we got in the above request's response.

PROPFIND https://apidata.googleusercontent.com/{user-principal-path}

<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:">
     <D:prop>
       <C:calendar-home-set xmlns:C="urn:ietf:params:xml:ns:caldav"/>
     </D:prop>
</D:propfind>

cf) Another way of finding the calendar-home-set using REPORT principal-match didn't work in my case.

  1. PROPFIND calendar-home-set with Depth header value 1.
PROPFIND https://apidata.googleusercontent.com/{calendar-home-set-path}
Depth: 1

<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:"
            xmlns:C="urn:ietf:params:xml:ns:caldav">
     <D:prop>
        <D:displayname/>
        <D:resourcetype/>
        <C:supported-calendar-component-set/>
     </D:prop>
</D:propfind>
KeepCoding
  • 13
  • 4