【问题标题】:How can I send an invitation to the guest by Google Apps Script for Calendar如何通过 Google Apps Script for Calendar 向客人发送邀请
【发布时间】:2016-11-28 11:02:33
【问题描述】:

我正在尝试通过 Google Apps 脚本将来宾添加到日历活动,并在我的脚本添加来宾后立即发送邀请。 但我找不到向客人发送电子邮件邀请的方法。

var events = calendar.getEvents(start_date, end_date)
event.addGuest('guest_email@gmail.com');

有没有办法从 Apps Script 向客人发送邀请?

我重写了高级 Google 服务,但我添加的访客仍然无法收到邀请电子邮件。

var body = {
  'sendNotification': true,
  'attendees': attendees
};

var ret = Calendar.Events.patch(body, calendarId, eventId);

【问题讨论】:

标签: google-apps-script google-calendar-api


【解决方案1】:

您可以在高级 Google 服务中使用日历,例如:

var event = Calendar.Events.get(calendarId, eventId);
Calendar.Events.patch(event, calendarId, eventId, {sendNotifications: true});

将通知发送设置为 true

请参阅Calendar in the Advanced Google Services 上的文档。

【讨论】:

  • 谢谢。我在 Apps 脚本编辑器和开发人员控制台中启用了日历 API,并运行了您显示的示例代码,但它在第一行显示一条错误消息“未找到”。我错过了什么吗?
  • 你有有效的 calendarId 和 eventId 吗?
  • 我通过 CalendarApp.getCalendarsByName()[0].getId() 和 CalendarApp.getCalendarsByName()[0].getEvents().getId() 获得了 calenderId 和 eventId 但我会尝试进入另一种方式。谢谢!
  • 指南中的示例建议默认ID如下:var calendarId = 'primary';
  • 我想知道 Bardy 提到的通知是用户可以在事件发生前 10 分钟获得的事件通知(默认情况下)。当我将他添加到日历事件时,我需要向他发送邀请。对不起,如果我不清楚。
【解决方案2】:

我知道这是一个老话题,但我不得不向客人发送通知,然后我找到了这篇文章。

我通过在创建事件时使用选项成功地发送了没有 API 的通知。

var oNewEvent = oCalendar.createEvent(oEvents[i][1] + ' ouvre', dBegda,dEndda, 
{
    location: oEvents[i][5],
    guests:oEvents[i][7],
    sendInvites: true,
});

希望它可以帮助其他人。

【讨论】:

  • 上面的例子创建了一个事件,同时向客人发送电子邮件。 OP 询问如何在已经存在的事件的情况下发送电子邮件邀请。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-03-22
  • 2019-01-05
  • 2019-06-04
  • 1970-01-01
  • 2011-02-18
  • 1970-01-01
相关资源
最近更新 更多