【发布时间】:2021-04-29 18:22:26
【问题描述】:
目标:通过 Google 日历添加与会者到现场创建的现场活动中
上下文:正在创建的实时事件(左)+ 日历添加(右)
代码片段:
current_user = e.calendar.calendarId;
event_id = e.calendar.id;
var calendar = CalendarApp.getCalendarById(current_user);
var event = calendar.getEventById(event_id);
但是,当我打开一个事件并且current_user 和event_id 具有值时,event 似乎是null,因为这个事件在技术上还没有“创建”。如果它已经创建,那么一个简单的event.addGuest() 就可以了
是否可以在创建实时事件时对其进行自定义?我发现的每个示例都只更新已创建的事件。
编辑:忘记发布我正在使用的范围。 appsscript.json 的片段如下
{
....,
"oauthScopes": [
"https://www.googleapis.com/auth/calendar.addons.current.event.read",
"https://www.googleapis.com/auth/calendar.addons.current.event.write",
"https://www.googleapis.com/auth/calendar.addons.execute",
"https://www.googleapis.com/auth/script.external_request",
"https://www.google.com/calendar/feeds"
],
"addOns": {
"common": {
...
}
},
"calendar": {
"currentEventAccess": "READ_WRITE",
...
}
}
}
【问题讨论】:
-
我不这么认为。我不会浪费我的时间。但我不确定。为什么不继续尝试,让我们知道它是否有效。
-
它不起作用,我认为你是对的,谷歌还没有实现这样的逻辑。
-
我认为他们不希望您与他们的代码进行任何直接交互。
-
文档Workspace Calendar Event Objects 适合阅读此问题并希望查看文档的任何人。
标签: google-apps-script google-apps