我已使用 PHP 和服务帐户成功与 Google 日历集成。
我可以做什么:
我不能做什么:
这是迄今为止我用来完成所有事情的完整代码:
putenv('GOOGLE_APPLICATION_CREDENTIALS=credentials.json');
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
$client->setScopes('https://www.googleapis.com/auth/calendar');
$client->setSubject('[email protected] /cdn-cgi/l/email-protection');
$service = new Google_Service_Calendar($client);
$calendarID = 'primary';
$eventID = 'XXXXXXXXX';
$event = new Google_Service_Calendar_Event(array(
'sendNotifications' => true,
'attendees' => array(
array('email' => '[email protected] /cdn-cgi/l/email-protection)
)
));
$event = $service->events->patch($calendarID, $eventID, $event);
聚会迟到了,但由于没有答案......
我刚刚遇到了同样的问题。一些事情:
-
sendNotifications
已弃用,您应该使用发送更新 https://developers.google.com/calendar/v3/reference/events/update#sendUpdates反而。
- 可选参数不会出现在事件本身中 - 它们会出现在请求中。所以你最终会得到:
$event = $service->events->patch(
$calendarID,
$eventID,
$event,
['sendUpdates' => 'all']
);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)