我正在尝试编写一个Google脚本,该脚本将从一个日历(pubCal)移动到给定时间范围内的所有事件到另一个日历(privCal)。
我不知道为什么,但是代码在行中断开:“Calendar.Events.move(pubCalId,eventToMove.getId(),privCalId);”,并显示错误消息:“Not Found”(第18行,文件“代码”)“
此错误消息的含义是什么?
function export_gcal_to_gsheet(){
//pubCall: public calendar
//privCal private calendar
var pubCalId = "addressForPubicCal@group.calendar.google.com";
var privCalId = "addressForPrivateCal@group.calendar.google.com";
var pubCal = CalendarApp.getCalendarById(pubCalId);
//Change date range to move events from pubCal to privCal
var startDate = "January 1, 2018 00:00:00 CST";
var endDate = "January 04, 2018 23:59:59 CST";
// Extract events between certain dates in public calendar.
var events = pubCal.getEvents(new Date(startDate), new Date(endDate));
//Loop through all Calendar events
while (events.length > 0){
var eventToMove = events.shift();
Calendar.Events.move(pubCalId, eventToMove.getId(), privCalId);
}
}
答案 0 :(得分:1)
以下修改怎么样?
Calendar.Events.move(pubCalId, eventToMove.getId(), privCalId);
Calendar.Events.move(pubCalId, eventToMove.getId().replace("@google.com", ""), privCalId);
eventToMove.getId()
ID为#####@google.com
。但用于Calendar.Events.move()
的ID为#####
。因此,@google.com
需要从#####@google.com
中移除#####@google.com
。
for c in img.find_circles(threshold = 1600, x_margin = 10, y_margin = 10,r_margin = 10):
img.draw_circle(c.x(),c.y(),c.r(),color = (255,0,0))
print(c)
,因此会发生错误。如果我误解了你的问题,我很抱歉。