2017-06-03 130 views
0

此问题刚刚问过,但尚未得到解答。我认为事情从那以后就发生了。如何使用API​​设置Google日历活动的颜色

我可以使用API​​创建一个事件,但我无法将颜色设置为默认值以外的任何其他值。这是:colorId不工作?有任何想法吗?

event = Google::Apis::CalendarV3::Event.new({ 
                :summary => @measure.value, 

                :description => 'created by ' + current_user.username, 
                :start => { 
                 :date_time => event_starttime 
                }, 
                :end => { 
                 :date_time => event_endtime 
                }, 
                :colorId => "6" 
               }) 

回答

0

在使用Events.insert创建日历事件,有一个叫colorId

colorId串事件的颜色可选属性。这是一个ID,指颜色定义的事件部分中的 条目(请参阅颜色 端点)。可选的。可写

检查Colors property resource关于设置背景和前景色的格式。

+0

在我上面的示例代码中,我有:colorId ....这是不正确的吗? – monkstownman

1

我刚刚遇到这个,因为我遇到了同样的问题。我使用的是红宝石的API客户端和我挖成其code找到这样的:

# The color of the event. This is an ID referring to an entry in the event 
# section of the colors definition (see the colors endpoint). Optional. 
# Corresponds to the JSON property `colorId` 
# @return [String] 
attr_accessor :color_id 

更新我的事件插入通话使用color_id: 'a number from 1 to 11'为我工作。