在 G-Suite 插件中获取 CalendarEvent 的重复
Get recurrence of CalendarEvent in G-Suite Addon
我正在开发一个 Google 日历插件,可以将事件数据与外部服务同步。获取事件的标题、描述、日期等数据很容易,我什至可以使用 event.isRecurringEvent()
.
检查它是否是重复发生的事件
我似乎无法找到的是如何获取特定事件的重复规则。这可能吗? https://developers.google.com/apps-script/reference/calendar/calendar-event nor https://developers.google.com/apps-script/reference/calendar/calendar-event-series 都没有像 getRecurrenceRule()
这样的东西
感谢您的帮助!
如果我没理解错的话,你在 Google Apps 脚本中有一个 CalendarEvent,你想重复使用它。
因为正如您所说,没有像 getRecurrenceRule()
这样的方法,您将必须激活 Advanced Calendar Service and call 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()
编辑的字符串 return 之后 @
之后的字符,因为它附加了 @google.com
。
recurrence
是“重复事件的 RRULE、EXRULE、RDATE 和 EXDATE 行的列表,如 RFC5545". Even though this has information of the recurrence of the event, it's not an instance of the Apps Script class RecurrenceRule 中所指定。据我所知,没有办法 return那个。
参考:
希望对您有所帮助。
我正在开发一个 Google 日历插件,可以将事件数据与外部服务同步。获取事件的标题、描述、日期等数据很容易,我什至可以使用 event.isRecurringEvent()
.
我似乎无法找到的是如何获取特定事件的重复规则。这可能吗? https://developers.google.com/apps-script/reference/calendar/calendar-event nor https://developers.google.com/apps-script/reference/calendar/calendar-event-series 都没有像 getRecurrenceRule()
感谢您的帮助!
如果我没理解错的话,你在 Google Apps 脚本中有一个 CalendarEvent,你想重复使用它。
因为正如您所说,没有像 getRecurrenceRule()
这样的方法,您将必须激活 Advanced Calendar Service and call 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()
编辑的字符串 return 之后@
之后的字符,因为它附加了@google.com
。 recurrence
是“重复事件的 RRULE、EXRULE、RDATE 和 EXDATE 行的列表,如 RFC5545". Even though this has information of the recurrence of the event, it's not an instance of the Apps Script class RecurrenceRule 中所指定。据我所知,没有办法 return那个。
参考:
希望对您有所帮助。