本文介绍了如何使用Google Script将日历事件复制(复制)到另一个日历中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Google日历中有几个日历。我正在学习Google脚本,并希望创建一个脚本,将一个事件从我的一个日历复制到另一个日历,并有机会修改参数,例如重复。
I have several calendars in Google Calendar. I'm learning Google Script and would like to create a script that copies an event from one of my calendars to another with a chance to modify parameters such as recurrence.
推荐答案
一些代码开始:
Some code to start with:
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);
}
}
这会让你开始,
这篇关于如何使用Google Script将日历事件复制(复制)到另一个日历中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!