简体   繁体   English

事件保存/更新时的 g-suite Google 日历应用程序脚本

[英]g-suite Google Calender Apps script On Event Save/Update

First of all, i am new to Google Workspace and this is the first time i am developing an addon.首先,我是 Google Workspace 的新手,这是我第一次开发插件。 I am trying to develop a Google Workspace(gsuite) Addon using Google Apps Script, My main objectives are:我正在尝试使用 Google Apps Script 开发一个 Google Workspace(gsuite) 插件,我的主要目标是:

  1. Whenever i create/save/update an event in Google Calender, i want to make an alert asking for ok and cancel , if i click cancel the event should not be created and if i click ok then the event should be created and the script function should call my API endpoint with the following parameters:每当我在 Google Calender 中create/save/update事件时,我都想发出警报,要求okcancel ,如果我单击取消,则不应创建该事件,如果单击确定,则应创建该事件和脚本功能应该使用以下参数调用我的 API 端点:

     { summary: summary_of_the_event, created: event_created_or_updated_date, googleCalendarId: calender_id }

Here is the reference to Apps script Google calender:以下是对 Apps 脚本 Google 日历的参考:

https://developers.google.com/apps-script/reference/calendar/calendar-app https://developers.google.com/apps-script/reference/calendar/calendar-app

I appreciate the help.我很感激你的帮助。

Some thoughts about calendar add-ons关于日历插件的一些想法

  • CalendarApp features the installable calendar trigger with the specification : CalendarApp具有可安装的日历触发器规范

    Calendar triggers fire when a user's calendar events are updated (created, edited, or deleted).当用户的日历事件更新(创建、编辑或删除)时,日历触发器会触发。

    • Installble triggers can be used in Google Workspace add-ons Installble 触发器可用于Google Workspace 插件

    • Howver, this installable trigger only fire after the event has been created / updated, so it can help you to cancel event creation, but rather no manually delete the event a posteriori.但是,此可安装触发器仅在事件创建/更新后触发,因此它可以帮助您取消事件创建,而不是事后手动删除事件。

    • Mind also that the when the trigger fires, it does not give you any information about the created / updated event - you have to manually find this event eg by querying for the least created / updated event in user's calendar.还请注意,当触发器触发时,它不会为您提供有关创建/更新事件的任何信息 - 您必须手动查找此事件,例如通过查询用户日历中最少创建/更新的事件。

  • Google Workspace Calendar add-ons feature the manifest trigger for updating calendar events calendar.eventUpdateTrigger Google Workspace 日历插件具有更新日历事件清单触发器calendar.eventUpdateTrigger

    • Thereby:从而:

    This trigger only fires if the user makes one or more of the following edits:此触发器仅在用户进行以下一项或多项编辑时触发:

    Adds one or more attendees.添加一名或多名与会者。

    Removes one or more attendees.删除一名或多名与会者。

    Adds or switches to a different conferencing solution.添加或切换到不同的会议解决方案。

  • Google Workspace Calendar add-ons also feature the manifest trigger calendar.eventOpenTrigger Google Workspace Calendar 插件还具有清单触发器calendar.eventOpenTrigger

    • It fires when you open an event (this is what you want!).当你打开一个事件时它会触发(这就是你想要的!)。
    • However, this work only for already existing events - not when a user opens the Calendar UI interface to create a new event但是,这仅适用于已经存在的事件 - 不适用于用户打开日历 UI 界面以创建新事件
  • Instead of letting a user create / update events through the regular Calendar UI, you can use Card Service to create a custom add-on interface where the user can specify that he wants to create an event不是让用户通过常规日历 UI 创建/更新事件,您可以使用Card Service创建自定义附加界面,用户可以在其中指定他想要创建的事件
    • Within the card interface, it is easier to implement an ok / cancel functionality (as a card) and then (in case "ok" is clicked) create an event for the user programmatically.在卡片界面中,更容易实现确定/取消功能(作为卡片),然后(如果单击“确定”)以编程方式为用户创建事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 G-Suite Enterprise 的 Google Apps 脚本中显示 Google Picker,无需访问 GCP - Show Google Picker in a Google Apps Script in G-Suite Enterprise without access to GCP 如何将 Google Apps Script Web 应用程序发布到 G-Suite Marketplace? - How to publish a Google Apps Script web app to the G-Suite Marketplace? 批量更新用户G-suite - Bulk Update users G-suite 是否可以更改文件夹的权限并使用Apps Script(G-Suite)以编程方式移动它? - Can I change permission of a folder and move it programmatically using Apps Script (G-Suite)? 带有附件的Google G-Suite表单上的自定义验证 - custom validation on Google G-Suite Form with an add-on G-Suite 用户访问 G-Suite 可信应用脚本时,如何避免脚本授权提示? - How to avoid script authorization prompt when G-Suite user is accessing G-Suite trusted app script? 是否可以将 Google Apps Script Web App 发布到 G Suite Marketplace? - Is it possible to publish a Google Apps Script Web App to G Suite Marketplace? 使用 Google Apps 脚本发送的 G Suite 电子邮件未发送“邮件已阻止” - G Suite Emails Sent with Google Apps Script Are Not Delivered "Message Blocked" 有G Suite / Google Apps API吗? - Is there a G Suite/Google Apps API? 当我在 G-Suite 市场上更新 GAS 插件时,它会自动更新吗? - Do GAS add-on update automatically when I update it on G-Suite marketplace?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM