简体   繁体   中英

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. I am trying to develop a Google Workspace(gsuite) Addon using Google Apps Script, My main objectives are:

  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:

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

Here is the reference to Apps script Google calender:

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 :

    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

    • 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

    • 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

    • 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
  • 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
    • 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM