Google Apps Script: Setting color of an event using Calendar API

后端 未结 4 1670
感情败类
感情败类 2021-01-14 14:55

I would like to set specific colors for events.

I believe I have to use the Calendar API. I cannot figure out how to do this.

The code I am trying is:

4条回答
  •  无人及你
    2021-01-14 15:17

    This is always possible. Try it out instead.

    in your function:

    var newEvent = calendar.createEvent(event_title, event_start_time, event_end_time, 
      {
        location: event_location, 
        guests: newGuests, 
        sendInvites: 'true', 
        description: event_description
      }
    );
    
    newEvent.setColor('4');
    

    Refer to: https://developers.google.com/apps-script/reference/calendar/event-color

    The string to set is the numerical string representation of event color.

提交回复
热议问题