本文介绍了在Google日历中更改事件的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我试图使用Google Apps脚本中的高级日历服务来更改日历中特定事件的colorId。 到目前为止,我已经能够列表和获取事件以及我喜欢的事件。所以我有事件的ID。 function getSpecificEvent(){ var calendarId ='primary'; var eventId ='7h2tbvns2oo4r5gku6ghjfjclk'; var calEvent = Calendar.Events.get(calendarId,eventId); Logger.log(calEvent); $ b $ p $ b 这是我在编辑colorID时尝试的,我使用 修补程序 : 函数setEventColor(){ var calendarId ='primary'; var eventId ='7h2tbvns2oo4r5gku6ghjfjclk'; Calendar.Events.patch(calendarId,eventId).colorId('11'); } 但是我得到这个错误: 第33行是这一行: Calendar.Events.patch(calendarId,eventId).colorId 解决方案 这有点棘手,但我发现它是如何工作的: 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)} 此文章(匿名)非常有帮助 Im trying to use the advanced calendar service in Google Apps Script to change the colorId on a particular event in my calendar.So far i have been able to list and get event's and the event i like. So i have the ID of the event. function getSpecificEvent(){ var calendarId = 'primary'; var eventId = '7h2tbvns2oo4r5gku6ghjfjclk'; var calEvent = Calendar.Events.get(calendarId, eventId); Logger.log(calEvent);}This is what im trying when editing the colorID, i use patch:function setEventColor(){ var calendarId = 'primary'; var eventId = '7h2tbvns2oo4r5gku6ghjfjclk'; Calendar.Events.patch(calendarId, eventId).colorId('11');}But then i get this error:Line 33 in this case is this line: Calendar.Events.patch(calendarId, eventId).colorId 解决方案 This is a bit tricky... but I found how it works :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)}This post (anonymous) was very helpful 这篇关于在Google日历中更改事件的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-06 22:41