繁体   English   中英

在 G-Suite 插件中获取 CalendarEvent 的重复发生

[英]Get recurrence of CalendarEvent in G-Suite Addon

我正在开发一个 Google 日历插件,它可以将事件数据与外部服务同步。 获取事件的标题、描述、日期等数据很容易,我什至可以使用event.isRecurringEvent()检查它是否是重复发生的事件。

我似乎无法找到的是如何获取特定事件的重复规则。 这甚至可能吗? https://developers.google.com/apps-script/reference/calendar/calendar-eventhttps://developers.google.com/apps-script/reference/calendar/calendar-event-series都没有类似getRecurrenceRule()东西getRecurrenceRule()

谢谢你的帮助!

如果我理解正确的话,您在 Google Apps 脚本中有一个CalendarEvent并且您希望它重复发生。

由于,正如您所说,没有像getRecurrenceRule()这样的方法,因此您必须激活高级日历服务并调用Events: get以获取有关事件重复发生的信息。 如果event是您的CalendarEvent ,您可以通过执行以下操作来检索有关重复的信息:

eventId = event.getId().split("@")[0];
var eventFromAPI = Calendar.Events.get(calId, eventId);
var recurrence = eventFromAPI["recurrence"];
return recurrence;

笔记:

  • 我正在使用split来删除event.getId()返回的字符串的@之后的字符,因为它附加了@google.com
  • recurrence是“重复事件的 RRULE、EXRULE、RDATE 和 EXDATE 行列表,如RFC5545 中所指定”。 即使这具有事件重复发生的信息,它也不是 Apps 脚本类RecurrenceRule的实例。 据我所知,没有办法退回。

参考:

我希望这有任何帮助。

暂无
暂无

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

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