Google apps script 有没有办法通过谷歌应用程序脚本修改实时日历事件?

Google apps script 有没有办法通过谷歌应用程序脚本修改实时日历事件?,google-apps-script,google-apps,Google Apps Script,Google Apps,目标:通过谷歌日历加载项将与会者添加到现场创建的活动中 上下文:正在创建的实时事件(左)+日历加载项(右) 代码剪报: current_user = e.calendar.calendarId; event_id = e.calendar.id; var calendar = CalendarApp.getCalendarById(current_user); var event = calendar.getEventById(event_id); 但是,当我打开一个事件时,current_

目标:通过谷歌日历加载项将与会者添加到现场创建的活动中

上下文:正在创建的实时事件(左)+日历加载项(右)

代码剪报:

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",
      ...
    }
  }
}
将代码更改为:

  if (!e.calendar.capabilities.canAddAttendees) {
    return;
  }

  CardService.newCalendarEventActionResponseBuilder()
    .addAttendees(["example1@example.com", "example2@example.com"])
    .build();
请参阅以下网址的文档:

我不这么认为。我不会浪费时间的。但我不确定。为什么不试试它,让我们知道它是否有效。它不起作用,我认为你是对的,谷歌还没有实现这样的逻辑。我认为他们不希望你与他们的代码有任何直接的交互。该文档面向阅读此问题并想看文档的任何人。谢谢你的解决方案。如果你不介意的话,我还有一个问题。因此,我注意到,当您查看附加组件并添加与会者(通过您共享的代码或手动添加)时,它实际上会将日历附加组件刷新到主页上(离开它所在的页面)。令我感到奇怪的是,目前我使用的触发器是:“homepageTrigger”:{“runFunction”:“onHomePage_noevent”},“eventOpenTrigger”:{“runFunction”:“onHomePage”}为什么在添加与会者时,“onHomePage”会再次弹出?不幸的是,我不知道您额外问题的答案。我需要研究一下。你可以在这里问另一个问题,也可以在网上问