dru*_*392 2 php google-calendar-api
我已经使用 PHP 和一个服务帐户成功地与 Google 日历集成。
我可以做什么:
我不能做什么:
这是到目前为止我用来完成所有事情的完整代码:
putenv('GOOGLE_APPLICATION_CREDENTIALS=credentials.json');
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
$client->setScopes('https://www.googleapis.com/auth/calendar');
$client->setSubject('example@gmail.com');
$service = new Google_Service_Calendar($client);
$calendarID = 'primary';
$eventID = 'XXXXXXXXX';
$event = new Google_Service_Calendar_Event(array(
'sendNotifications' => true,
'attendees' => array(
array('email' => 'email1@gmail.com)
)
));
$event = $service->events->patch($calendarID, $eventID, $event);
Run Code Online (Sandbox Code Playgroud)
聚会迟到了,但由于没有答案......
我刚刚遇到了完全相同的问题。几样东西:
sendNotifications已弃用,您应该改用sendUpdates。$event = $service->events->patch(
$calendarID,
$eventID,
$event,
['sendUpdates' => 'all']
);
Run Code Online (Sandbox Code Playgroud)