gpt4 book ai didi

google-apps-script - 将事件从表单和电子表格插入谷歌日历(错误)

转载 作者:行者123 更新时间:2023-12-04 15:23:35 24 4
gpt4 key购买 nike

在过去的几个月里,我的办公室一直在使用一个系统,我们可以在其中提交谷歌表格以休假或旅行。此表单会自动填充 Google 表格,然后自动弹出到共享日历。今天它停止工作了。我进入了代码,但收到错误“ session 名称值无效(第 111 行,文件“代码””)。

我做了一些实验,如果我在工作时将“var calendarId”更改为 = 我的个人电子邮件地址,那么它可以毫无问题地发布到我的日历中。如果我将其改回共享日历地址,则会出现错误。

在这一点上,我认为我的代码没有损坏,我觉得我的机构(政府)限制了我使用代码发布到共享日历的能力。我在这里错过了什么吗?任何想法表示赞赏。谢谢!

/**
* Creates an event in the user's default calendar.
*/
function createEvent(title,startDt,endDt,desc,loc, col) {
var calendarId = 'THIS IS WHAT IS CAUSING THE PROBLEM';
Logger.log(typeof(startDt))
var start = new Date(startDt);
**var startISO = start.toISOString();**
var end = new Date(endDt);
var endISO = end.toISOString();
var event = {
summary: title,
location: loc,
description: desc,
start: {
dateTime: startISO
},
end: {
dateTime: endISO
},
// Sets the calendar color
colorId: col
};
event = Calendar.Events.insert(event, calendarId);
Logger.log('Event ID: ' + event.getId());
}

所以今天早上我进来了,广告我不再收到上周的无效错误。现在我收到一个新错误,“RangeError:日期无效。 (第 95 行,文件“代码”)

最佳答案

对我来说,使用颜色 ID 1-11 有效。
Calendar.Colors.get() 返回了更多的 id,但那些 >11 导致了那个错误

关于google-apps-script - 将事件从表单和电子表格插入谷歌日历(错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36206980/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com