简体   繁体   中英

Google Apps Script and Trigger when new Calendar Event is added

I want to have a Goggle Apps Script be run when a new Calendar Event is added to a Google Calendar. How can I setup the trigger? I know what I want to script (change color for an event based on the text in the Title). I just don't see where to setup the trigger to run my script.

You can use the new Google Calendar Event Triggers . You can create the code with a script similar to the following to trigger your function:


     ScriptApp
      .newTrigger('findNewEvents')
      .forUserCalendar(Session.getActiveUser().getEmail())
      .onEventUpdated()
      .create()
  

Then you can loop through the events in your calendar to find any events recently created and pass them to your function.

  1. Go to https://script.google.com/home/triggers (also available in your script editor, go to Edit -> All your triggers).
  2. Create or edit the trigger for your script.
  3. For event source use "From calendar", put "Calendar updated" to calendar details (see the image below) and specify the calendar owner email.

触发配置

This feature is not supported yet as of now. You can see that no resolution has been provided in this issue tracker . You will have to rely on your own workaround implementation or open a new feature request .

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