Google日历PHP API不发送邀请电子邮件
我已经成功地与谷歌日历集成使用PHP与服务帐户 我能做什么:Google日历PHP API不发送邀请电子邮件,php,google-calendar-api,Php,Google Calendar Api,我已经成功地与谷歌日历集成使用PHP与服务帐户 我能做什么: putenv('GOOGLE_APPLICATION_CREDENTIALS=credentials.json'); $client = new Google_Client(); $client->useApplicationDefaultCredentials(); $client->setScopes('https://www.googleapis.com/auth/calendar'); $client->s
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);
- 更新日历事件
- 将与会者添加到日历事件中
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);
- 添加新与会者时发送邀请电子邮件
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);
晚会迟到了,但因为没有答案 我也有同样的问题。几件事:
已被弃用,您应该改用sendNotifications
- 可选参数不会出现在事件本身上,而是出现在请求中。因此,你最终会:
这对我也很管用!谢谢我感到困惑的是,他们在文档中没有提到它:(虽然sendNotifications已被弃用,但它似乎仍然是在附加组件中使用appscript的高级日历服务时唯一有效的方法。有人能对此进行解释吗?有效的解决方案就在这里=