我在 Google 日历中有几个日历。我正在学习 Google 脚本,并希望创建一个脚本,将事件从我的一个日历复制到另一个日历,并有机会修改参数(例如重复发生)。
一些代码开始:
function myFunction() {
var calendarSource = CalendarApp.getCalendarById("calendarID");
var calendarDestination = CalendarApp.getCalendarById("calendarID");
var eventToCopy = calendarSource.getEvents(new Date("July 21, 2009 EST"), new Date("July 22, 2009 EST"));
//read up: https://developers.google.com/apps-script/class_recurrence
var newRecurrence = CalendarApp.newRecurrence().addWeeklyRule().times(10);
for (var i in eventToCopy){
if (eventToCopy[i].getTitle() == "event name"){
var newEvent = calendarDestination.createEventSeries(eventToCopy[i].getTitle(), eventToCopy[i].getStartTime(), eventToCopy[i].getEndTime(), newRecurrence);
}
}
这应该可以帮助你开始,
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)