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


i set specific colours events. believe have use calendar api. cannot figure out how this.

the code trying is:

var event = calendarapp.getownedcalendarbyid(calendarid).createevent(class, starttime, endtime, {description:lessonplandatacomplete [t], colorid: 11});

the colorid 11 should set red events coming out default colour.

any helps/hints gratefully received, many thanks, simon

it possible using advanced calendar service.

(this post helpful)

the code create new event goes : (inspired google's example)

function createevent() {   var calendarid = 'primary';   var event = {     summary: 'other test',     location: 'right here',     description:' chat... ;-)',     start: {       datetime: new date().toisostring()     },     end: {       datetime: new date(new date().gettime()+3600000).toisostring()     },     attendees: [       {email: 'user@gmail.com'}     ],     // red background. use calendar.colors.get() full list.     colorid: 11   };   event = calendar.events.insert(event, calendarid);   logger.log('event id: ' + event.getid()); } 

and modify existing event (having id) goes :

function changeeventcolor(){   var calendarid = 'primary';   var eventid = 'omv°°°°°°°°°°8jbs'   var event = calendar.events.get(calendarid, eventid)   logger.log('current color = '+event.colorid)   event.colorid = 11   calendar.events.patch(event,calendarid,eventid);   logger.log('new color = '+event.colorid) } 

color codes listed using (for example) google online api tryout here

the advanced google calendar service has enabled before run code using ressources menu in script editor, see illustration below.

enter image description here


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -