在Gcalendar中创建一个振动

发布于 2025-02-03 06:39:51 字数 703 浏览 2 评论 0原文

我如何在每个脚本中在gcalendar中创建焦点时间。我已经创建了这个scipt,但是我会回到一个错误。有人使用我的理解是正确的,语法还可以:

function myFunction() {
  //Is is working
  var event1 = CalendarApp.getDefaultCalendar().createEvent('MyTimeSlot',  new Date('Juni 01, 2022 20:00:00 UTC'),  new Date('Juni 01, 2022 21:00:00 UTC'));

  // Error: ReferenceError: CalendarEvent is not defined
  var event2 = CalendarApp.getDefaultCalendar(">>>MyTimeSlot with FOCUS TIME<<<", new Date('Juni 01, 2022 20:00:00 UTC'), new Date('Juni 01, 2022 21:00:00 UTC'), {type: CalendarEvent.EventType.FOCUS_TIME});

  event1.setColor(CalendarApp.EventColor.PALE_BLUE);
  event2.setColor(CalendarApp.EventColor.PALE_RED);
}

问候

how I can create a focus time in GCalendar per script. I have created this scipt but I get a error back. Does anyone use why I my understanding is correct the syntax is OK:

function myFunction() {
  //Is is working
  var event1 = CalendarApp.getDefaultCalendar().createEvent('MyTimeSlot',  new Date('Juni 01, 2022 20:00:00 UTC'),  new Date('Juni 01, 2022 21:00:00 UTC'));

  // Error: ReferenceError: CalendarEvent is not defined
  var event2 = CalendarApp.getDefaultCalendar(">>>MyTimeSlot with FOCUS TIME<<<", new Date('Juni 01, 2022 20:00:00 UTC'), new Date('Juni 01, 2022 21:00:00 UTC'), {type: CalendarEvent.EventType.FOCUS_TIME});

  event1.setColor(CalendarApp.EventColor.PALE_BLUE);
  event2.setColor(CalendarApp.EventColor.PALE_RED);
}

Greetings

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

厌倦 2025-02-10 06:39:51

event2上的错误是因为您正在创建focus Time事件。

评论更新

  • 我理解正确吗?它行不通吗?

是的,EventType参数,如事件文档是仅读取参数。

为此,已经在Google的“问题跟踪器”上报告了功能请求,您可以去那里并出演问题以获取更新:

通过Google脚本中的API日历编码 /p>

The error on event2 is because you are creating a Focus Time event.

Update from comment

  • Do I understand correctly? It does not work?

Yes, the eventType parameter, as mentioned on the Events documentation is a read-only parameter.

There is already a feature request reported on Google's Issue Tracker for this, you can go there and star the issue to get updates on it:

Create programmatically Focus Time via the API CalendarApp coding in Google Script

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文