api - 如何使用 API 设置 Google 日历事件的颜色

标签 api google-calendar-api

这个问题已经被问过一段时间了,但还没有得到解答。我认为从那以后事情已经发生了变化。

我可以使用 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"
                                                })

最佳答案

我刚刚遇到这个问题是因为我遇到了同样的问题。我正在使用 ruby​​ 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' 对我有用。

关于api - 如何使用 API 设置 Google 日历事件的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44342708/

相关文章:

jquery - 计算div jquery中的左定位

c# - 从系统帐户为用户创建 ServiceAccountCredential

api - 是否可以使用 Twilio 一次向多个号码发送一条消息?

javascript - 根据用户输入显示来自 twitter API 的推文

api - 谷歌数据 API : OAuth authenticate URL instead of authorize URL?

android - 如何为事件列表构建 API,以便将来更新

Javascript omdb api不会发送所有信息

javascript - 谷歌日历API将定时事件转换为JS中的全天事件

c# - 强命名 Google.Apis

c# - 整合谷歌日历的问题