google-apps-script - 谷歌日历无法通过 ID 删除事件

标签 google-apps-script google-calendar-api

所以我有一个应用程序脚本代码来创建这样的事件:

var cal = CalendarApp.getCalendarById(calendarId);
var start = new Date(startDt);
var end = new Date(endDt); 
var event = cal.createEvent(title, start, end, {
 description : desc,
});   

它工作正常,在它创建事件后,我使用

event.getId()

记录事件id

当我运行以下代码以使用我记录的 ID 删除事件时,它告诉我该事件不存在。

var cal = CalendarApp.getCalendarById(calendarId);
var event = cal.getEventSeriesById(evc2);
event.deleteEventSeries();
return;

为什么找不到事件?
我用来记录事件 ID 的代码不正确吗?
或者我尝试删除事件的方式不正确?

最佳答案

所以代码在我单独运行时有效,所以问题出在其他地方。 在做了一些清理并删除未使用的变量之后,它又开始工作了。我无法弄清楚问题出在哪里,但它现在正在工作,感谢您的投入

关于google-apps-script - 谷歌日历无法通过 ID 删除事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40646734/

相关文章:

google-apps-script - 我的应用程序脚本代码似乎一夜之间消失了。我怎样才能恢复它?

javascript - Google Calendar API 获取事件详细信息

react-native - react 本地Google日历

javascript - 谷歌应用程序脚本循环范围参数

oauth - 有没有办法从外部应用程序修改在 Google 日历中创建的事件?

java - 需要有关 Google API Calendar V3 Java 和 OAUTH2 的帮助

javascript - Google 日历嵌入事件信息

javascript - 如何将 CSV 或 XLS 内容添加到 Gmail 到 Google 表格中的下一个可用行?

google-apps-script - Google Apps 脚本/插件的域范围授权

javascript - 使用缓存提高脚本的速度