通过Google的API分享Google日历

时间:2010-08-09 13:01:26

标签: java google-calendar-api

我可以通过Google Calendar API在我的帐户中制作Google日历,但我也想分享它。有没有办法以编程方式执行此操作?

2 个答案:

答案 0 :(得分:4)

来自Google Calendar API文档:Sharing calendars

答案 1 :(得分:0)

尝试此功能,看它是否有效。这将使您的域内共享日历。

function updateACLRole($cal_id, $USER) {
    $data = "<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gAcl='http://schemas.google.com/acl/2007' >
      <category scheme='http://schemas.google.com/g/2005#kind'
        term='http://schemas.google.com/acl/2007#accessRule'/>
      <gAcl:scope type='domain' value='".$this->CONSUMER_KEY."' ></gAcl:scope>
      <gAcl:role value='http://schemas.google.com/gCal/2005#read'></gAcl:role>
    </entry>";
    $uri = 'https://www.google.com/calendar/feeds/' . $cal_id . '/acl/full/domain%3A'.$this->CONSUMER_KEY.'?xoauth_requestor_id=' . urlencode($USER);

    $result = $this->gdataCal->put($data, $uri);

}