简体   繁体   English

Google Calendar API v3 sendNotification参数

[英]Google Calendar API v3 sendNotification param

I would like to create events with Google Calendar API Library for Javascript and send email notifications to the attendees, but I don't know where I can set the sendNotifications optional query param to true . 我想使用适用于Javascript的Google Calendar API库创建事件,并向与会者发送电子邮件通知,但是我不知道在哪里可以将sendNotifications可选查询参数设置为true

I've tried this way below, the event is being created but the notification is not working: 我在下面尝试过这种方式,正在创建事件,但通知无法正常工作:

var request = gapi.client.calendar.events.insert({
    'calendarId': 'primary',
    'resource': eventArray,
    'sendNotifications': true
});

request.execute(function(event) {
    console.log('Event link => ' + event.htmlLink);
});

Where can I set this param to true? 在哪里可以将此参数设置为true?

My question was very specific but I found a solution changing to a REST request then I could set the query parameter sendNotifications to true (this way below). 我的问题非常具体,但是我发现将解决方案更改为REST请求,然后可以将查询参数sendNotifications设置为true (下面是这种方式)。

If someone has the same problem I had, here's an option that worked for me: 如果有人遇到与我相同的问题,那么可以使用以下选项:

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);
});

Now, when I add the event programmatically, all the attendees receive the invite by email. 现在,当我以编程方式添加活动时,所有与会者都会通过电子邮件收到邀请。 :) :)

Useful links: 有用的链接:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM