我在在这里查看了 Mogsdad对类似问题的答案,但是这并不是我的问题所特有的.我还查看了Calendar类及其子类的文档,但没有方法(我认为应该实施;有待处理的功能请求)以复制单个事件从日历X到日历Y.
I looked at Mogsdad's answer to a sort-of-similar question here, but it's not incredibly specific to my problem. I've also looked at the documentation for the Calendar class and its subclasses, but there is no method (which should be implemented in my opinion; there is a pending feature request) for copying a single event from Calendar X to Calendar Y.
我想做的事情如下:
我能想到的唯一方法就是马虎(下面是半伪):
The only way I could think of how to do it is sloppy (semi-pseudo below):
// y is Calendar Y, z is the ID of Event Z function moveToNewCalendar(y, z) { var eventToMove = getEventByID(z); // eventDetails is an Object var eventDetails = getAllEventDetails(eventToMove); // This is not fun! y.createEvent(eventDetails); eventToMove.deleteEvent(); } function getAllEventDetails(e) { var details = {}; details["title"] = e.getTitle(); details["startTime"] = e.getStartTime(); // ... etc return details; } function createEvent(eventDetails) { // Create event using the information pulled from eventDetails }此功能可通过 Google Calendar API v3-功能,而不是通过GAS.
This functionality is available through the Google Calendar API v3 - move function, but not through GAS.
我认为主要问题是复制事件的详细信息.Calendar原型中没有 createEvent(Event e)的功能.有一种更简单的方法可以使我丢失吗?
I suppose that the main problem is copying the details of the event. There is no function to createEvent(Event e) in the Calendar prototype. Is there an easier way to do this that I'm just missing?
推荐答案此新库将为您提供完整的解决方案...我很高兴成为Beta版测试人员,并且我所有的测试均成功:-)
This new library written by Romain Vialard will give you a complete solution... I had the pleasure to be a beta tester and all my tests were successful :-)
更多推荐
Google Apps脚本将事件从一个日历移动到另一个日历
发布评论