【发布时间】:2026-02-02 17:45:01
【问题描述】:
我已使用 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);
【问题讨论】:
-
工作解决方案在这里 = *.com/questions/21523094/…