Google Calendar PHP API不发送邀请电子邮件 [英] Google Calendar PHP API Not Sending Invite Emails
本文介绍了Google Calendar PHP API不发送邀请电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已使用带有服务帐户的PHP成功地与Google日历集成.
I have successfully integrated with Google Calendar using PHP with a Service Account.
我可以做什么:
- 更新日历事件.
- 将参加者添加到日历活动中.
我不能做什么:
- 添加新与会者后发送邀请电子邮件.
这是到目前为止我用来完成所有工作的全部代码:
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);
推荐答案
晚些时候参加聚会,但由于没有答案...
Late to the party but since there are no answers...
我一直遇到这个完全相同的问题.几件事:
I've just been having this exact same problem. Few things:
-
sendNotifications
已过时,您应该使用 sendUpdates 代替. - 可选的Params不会继续在事件本身上发生-它们会在请求中出现.因此,您最终得到:
sendNotifications
is deprecated, you should be using sendUpdates instead.- The optional Params don't go on the event itself - they go in the request. So you end up with:
$event = $service->events->patch(
$calendarID,
$eventID,
$event,
['sendUpdates' => 'all']
);
这篇关于Google Calendar PHP API不发送邀请电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文