我正在尝试使用Google Apps脚本中的高级日历服务来更改日历中特定事件的colorId.
到目前为止,我已经能够列出并获得事件和我喜欢的事件.所以我有活动的ID.
function getSpecificEvent(){
var calendarId = 'primary';
var eventId = '7h2tbvns2oo4r5gku6ghjfjclk';
var calEvent = Calendar.Events.get(calendarId, eventId);
Logger.log(calEvent);
}
Run Code Online (Sandbox Code Playgroud)
这是我在编辑colorID时尝试的,我使用补丁:
function setEventColor(){
var calendarId = 'primary';
var eventId = '7h2tbvns2oo4r5gku6ghjfjclk';
Calendar.Events.patch(calendarId, eventId).colorId('11');
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,第33行是这一行:
Calendar.Events.patch(calendarId, eventId).colorId
Run Code Online (Sandbox Code Playgroud)