我可以通过Google Calendar API在我的帐户中制作Google日历,但我也想分享它。有没有办法以编程方式执行此操作?
答案 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);
}