如何使用Google Script将日历事件复制(复制)到另一个日历中?

编程入门 行业动态 更新时间:2024-10-09 18:25:29
本文介绍了如何使用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: developers.google/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将日历事件复制(复制)到另一个日历中?

本文发布于:2023-11-28 04:07:35,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:日历   如何使用   事件   Script   Google

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!