Calendars

所有現有日曆的集合。另請參閱「Calendars 與 CalendarList」。

如需本資源的方法清單,請見本頁結尾。

資源表示法

{
  "kind": "calendar#calendar",
  "etag": etag,
  "id": string,
  "summary": string,
  "description": string,
  "location": string,
  "timeZone": string,
  "dataOwner": string,
  "conferenceProperties": {
    "allowedConferenceSolutionTypes": [
      string
    ]
  },
  "labelProperties": {
    "eventLabels": [
      {
        "id": string,
        "backgroundColor": string,
        "name": string
      }
    ]
  },
  "autoAcceptInvitations": boolean,
  "workingHours": {
    "workingHoursEnabled": boolean,
    "availableTimes": [
      {
        "dayOfWeek": string,
        "periodStart": integer,
        "periodEnd": integer
      }
    ]
  }
}
屬性名稱 值 說明 附註
autoAcceptInvitations boolean 這個日曆是否會自動接受邀請。僅適用於資源日曆。
conferenceProperties nested object 這個日曆的會議屬性,例如允許的會議類型。
conferenceProperties.allowedConferenceSolutionTypes[] list 這個日曆支援的會議解決方案類型。

可能的值如下:

  • "eventHangout"
  • "eventNamedHangout"
  • "hangoutsMeet"
選用。

dataOwner string 日曆擁有者的電子郵件地址。僅適用於次要日曆。唯讀。
description string 日曆說明。選填。 writable
etag etag 資源的 ETag。
id string 日曆 ID。如要擷取 ID,請呼叫 calendarList.list() 方法。
kind string 資源類型 (「calendar#calendar」)。
labelProperties nested object 這個日曆上定義的標籤屬性。如果指定,則會覆寫現有的標籤屬性。如未指定,標籤屬性會維持不變。 writable
labelProperties.eventLabels[] list 這個日曆上定義的活動標籤。如果在更新日曆時提供這個值,系統會取代現有的活動標籤。

如要新增活動標籤,請在清單中加入新項目;如要從日曆中刪除標籤,請從清單中移除項目。

每個日曆最多可有 200 個標籤。

writable
labelProperties.eventLabels[].backgroundColor string 標籤的背景顏色,格式為十六進位,例如 "#039be5"。系統會以這個顏色顯示具有此標籤的事件。必填。 writable
labelProperties.eventLabels[].id string 標籤的 ID,插入新標籤時,可選擇是否提供。如未提供,系統會產生專屬 ID。更新標籤時必須提供。

如果提供,ID 在日曆中不得重複,且必須採用 UUID 格式。

writable
labelProperties.eventLabels[].name string 標籤名稱。(選用)

如有提供,長度不得超過 50 個半形字元。

writable
location string 日曆的地理位置 (格式不限)。選填。 writable
summary string 日曆名稱。 writable
timeZone string 日曆的時區。(格式為 IANA 時區資料庫名稱,例如「Europe/Zurich」)。選填。 writable
workingHours object 代表使用者工作時間的相關資訊。僅適用於 Google Workspace 使用者的主要日曆。如要更新工作時間,必須傳遞整個工作時間物件。如未指定 (或傳遞為空值或空白物件),現有工作時間會維持不變。如要停用工作時間或清除時間表,請將 workingHoursEnabled 設為 false (並省略 availableTimes 或傳遞空白清單)。 writable
workingHours.availableTimes[] list 工作時間。每個有空時段代表使用者一天的工時區塊。 writable
workingHours.availableTimes[].dayOfWeek string 星期幾。必填。可能的值包括:
  • 「monday」
  • 「tuesday」
  • 「wednesday」
  • 「thursday」
  • 「friday」
  • 「saturday」
  • 「sunday」
writable
workingHours.availableTimes[].periodEnd integer 時段結束時間,以當天開始後經過的分鐘數表示 (不含)。必填。 writable
workingHours.availableTimes[].periodStart integer 時段開始時間 (含),以當天開始後的分鐘數表示。必填。 writable
workingHours.workingHoursEnabled boolean 是否為這個日曆啟用工作時間。如果 availableTimes 為空白,則無法設為 true。 writable

方法

更清楚
清除主要日曆。這項作業會刪除與帳戶主要日曆相關聯的所有活動。
刪除
刪除次要日曆。使用 calendars.clear 清除主要日曆上的所有活動。
get
傳回日曆的中繼資料。
insert
建立次要日曆。

要求中經過驗證的使用者會成為新日曆的資料擁有者。

patch
更新日曆的中繼資料。這個方法支援修補語意。請注意,每項修補要求會耗用三個配額單位,建議先使用 get,再使用 update。您指定的欄位值會取代現有值。未在要求中指定的欄位則會維持不變。如果指定陣列欄位,系統會覆寫現有陣列,並捨棄先前的陣列元素。
transferOwnership
在 Google Workspace 組織的使用者之間轉移次要日曆。使用者必須通過驗證,並具備「管理日曆」管理員權限,以及下列其中一個授權範圍:
  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.calendars
。在要求中,將 useAdminAccess 設為 true。次要日曆必須處於有效狀態才能轉移。無法轉移已停用或刪除的日曆。
update
更新日曆的中繼資料。