更新用户日历列表中的现有日历。 立即试用。
请求
HTTP 请求
PUT https://www.googleapis.com/calendar/v3/users/me/calendarList/calendarId
参数
| 参数名称 | 值 | 说明 | 
|---|---|---|
| 路径参数 | ||
calendarId | 
        string | 
        
          日历标识符。如需检索日历 ID,请调用 calendarList.list 方法。如果您想访问当前登录用户的主要日历,请使用“primary”关键字。
         | 
      
| 可选的查询参数 | ||
colorRgbFormat | 
        boolean | 
        
          是否使用 foregroundColor 和 backgroundColor 字段写入日历颜色 (RGB)。如果使用此功能,基于索引的 colorId 字段将自动设置为最佳匹配选项。可选。默认值为 False。
         | 
      
授权
此请求需要获得以下至少一个范围的授权:
| 范围 | 
|---|
https://www.googleapis.com/auth/calendar | 
https://www.googleapis.com/auth/calendar.app.created | 
https://www.googleapis.com/auth/calendar.calendarlist | 
如需了解详情,请参阅身份验证和授权页面。
请求正文
在请求正文中,提供具有以下属性的 CalendarList 资源:
| 属性名称 | 值 | 说明 | 备注 | 
|---|---|---|---|
| 可选属性 | |||
backgroundColor | 
        string | 
        日历的主要颜色,采用十六进制格式“#0088aa”。此属性取代了基于编号的 colorId 属性。如需设置或更改此属性,您需要在 insert、update 和 patch 方法的参数中指定 colorRgbFormat=true。可选。 | 
        可写入 | 
colorId | 
        string | 
        日历的颜色。此 ID 是指颜色定义的 calendar 部分中的条目(请参阅colors 端点)。此属性已被 backgroundColor 和 foregroundColor 属性取代,在使用这些属性时可以忽略。可选。 | 
        可写入 | 
defaultReminders[] | 
        list | 
        已通过身份验证的用户对此日历设置的默认提醒。 | 可写入 | 
defaultReminders[].method | 
        string | 
        此提醒所使用的提醒方法。可能的值包括:
 添加提醒时必填。  | 
        可写入 | 
defaultReminders[].minutes | 
        integer | 
        提醒应在活动开始前多少分钟触发。有效值介于 0 到 40320(4 周,以分钟为单位)之间。 添加提醒时必填。  | 
        可写入 | 
foregroundColor | 
        string | 
        日历的前景颜色,格式为十六进制“#ffffff”。此属性取代了基于索引的 colorId 属性。如需设置或更改此属性,您需要在 insert、update 和 patch 方法的参数中指定 colorRgbFormat=true。可选。 | 
        可写入 | 
notificationSettings | 
        object | 
        已通过身份验证的用户正在接收的此日历的通知。 | 可写入 | 
notificationSettings.notifications[].method | 
        string | 
        用于传送通知的方法。可能的值为:
 添加通知时必填。  | 
        可写入 | 
notificationSettings.notifications[].type | 
        string | 
        通知的类型。可能的值包括:
 添加通知时必填。  | 
        可写入 | 
selected | 
        boolean | 
        日历内容是否显示在日历界面中。可选。默认值为 False。 | 可写入 | 
summaryOverride | 
        string | 
        已通过身份验证的用户为此日历设置的摘要。可选。 | 可写入 | 
响应
如果成功,此方法将在响应正文中返回 CalendarList 资源。
试试看!
使用下面的 API Explorer 对实际数据调用此方法,然后查看响应。