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

4

1 回答 1

0

答案评论中的链接已损坏。所以我在这里写了一个有效的答案。

  1. 使用 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 与我们在上述请求的响应中获得的主要 URL。

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)在我的情况下,另一种使用 REPORT principal-match 查找 calendar-home-set 的方法不起作用。

  1. PROPFIND 带有 Depth 标头值 1 的 calendar-home-set。
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>
于 2021-09-24T12:25:11.083 回答