Google 日历 API v3 sendNotification 参数
Google Calendar API v3 sendNotification param
我想使用 Google 日历 API 库为 Javascript 创建活动并向与会者发送电子邮件通知,但我不知道在哪里可以设置 sendNotifications
true
的可选查询参数。
我试过下面这种方法,正在创建事件但通知不起作用:
var request = gapi.client.calendar.events.insert({
'calendarId': 'primary',
'resource': eventArray,
'sendNotifications': true
});
request.execute(function(event) {
console.log('Event link => ' + event.htmlLink);
});
在哪里可以将此参数设置为 true?
我的问题非常具体,但我找到了一个更改为 REST 请求的解决方案,然后我可以将查询参数 sendNotifications
设置为 true
(如下所示)。
如果有人遇到与我相同的问题,这里有一个对我有用的选项:
var restRequest = gapi.client.request({
'method': 'POST',
'path': '/calendar/v3/calendars/primary/events',
'params': {'sendNotifications': 'true'},
'body': eventArray
});
restRequest.execute(function(event) {
console.log('Event link: ' + event.htmlLink);
});
现在,当我以编程方式添加活动时,所有与会者都会通过电子邮件收到邀请。 :)
有用链接:
我想使用 Google 日历 API 库为 Javascript 创建活动并向与会者发送电子邮件通知,但我不知道在哪里可以设置 sendNotifications
true
的可选查询参数。
我试过下面这种方法,正在创建事件但通知不起作用:
var request = gapi.client.calendar.events.insert({
'calendarId': 'primary',
'resource': eventArray,
'sendNotifications': true
});
request.execute(function(event) {
console.log('Event link => ' + event.htmlLink);
});
在哪里可以将此参数设置为 true?
我的问题非常具体,但我找到了一个更改为 REST 请求的解决方案,然后我可以将查询参数 sendNotifications
设置为 true
(如下所示)。
如果有人遇到与我相同的问题,这里有一个对我有用的选项:
var restRequest = gapi.client.request({
'method': 'POST',
'path': '/calendar/v3/calendars/primary/events',
'params': {'sendNotifications': 'true'},
'body': eventArray
});
restRequest.execute(function(event) {
console.log('Event link: ' + event.htmlLink);
});
现在,当我以编程方式添加活动时,所有与会者都会通过电子邮件收到邀请。 :)
有用链接: