Events: patch
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
更新事件。這個方法支援 patch 語意。請注意,每個修補要求都會消耗三個配額單位;建議使用 get
後接 update
。您指定的欄位值會取代現有值。您在要求中未指定的欄位會維持不變。如果指定陣列欄位,系統會覆寫現有的陣列,並捨棄任何先前的陣列元素。立即試用。
要求
HTTP 要求
PATCH https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId
參數
參數名稱 |
值 |
說明 |
路徑參數 |
calendarId |
string |
日曆 ID。如要擷取日曆 ID,請呼叫 calendarList.list 方法。如果您想存取目前登入使用者的主日曆,請使用「primary 」關鍵字。
|
eventId |
string |
事件 ID。
|
選用查詢參數 |
alwaysIncludeEmail |
boolean |
已淘汰且遭到忽略。即使沒有可用的真實電子郵件地址,系統仍會一律在 email 欄位中傳回值 (也就是提供產生的無效值),以供活動發起人、創作者和出席者使用。
|
conferenceDataVersion |
integer |
API 用戶端支援的會議資料版本號碼。版本 0 會假設不支援會議資料,並忽略事件主體中的會議資料。版本 1 支援複製 ConferenceData,以及使用 conferenceData 的 createRequest 欄位建立新會議。預設值為 0。可接受的值介於 0 到 1 (包含這兩者) 之間。 |
maxAttendees |
integer |
回應中可納入的出席者人數上限。如果出席者人數超過指定數量,系統只會傳回參與者。選用。
|
sendNotifications |
boolean |
已淘汰,請改用 sendUpdates。
是否要傳送活動更新通知 (例如說明變更等)。請注意,即使您將值設為 false ,系統仍可能會傳送部分電子郵件。預設為 false 。 |
sendUpdates |
string |
應收到活動更新通知 (例如標題變更等) 的邀請對象。
可接受的值如下:
- 「
all 」:通知會傳送給所有邀請對象。
- 「
externalOnly 」:通知只會傳送給非 Google 日曆邀請對象。
- 「
none 」:不會傳送通知。如要執行日曆遷移工作,建議改用 Events.import 方法。
|
supportsAttachments |
boolean |
執行操作的 API 用戶端是否支援事件附件。選用設定。預設值為 False。
|
授權
這項要求需要至少具備下列其中一個範圍的授權:
範圍 |
https://www.googleapis.com/auth/calendar |
https://www.googleapis.com/auth/calendar.events |
https://www.googleapis.com/auth/calendar.app.created |
https://www.googleapis.com/auth/calendar.events.owned |
詳情請參閱「驗證與授權」頁面。
要求主體
在要求主體中,根據修補語義規則提供事件資源的相關部分。
試試看!
您可以使用下方的 API Explorer,針對即時資料呼叫這個方法,然後查看回應。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[],[],null,["# Events: patch\n\n| **Note:** Requires [authorization](#auth).\n\nUpdates an event. This method supports patch semantics. Note that each patch request consumes three quota units; prefer using a `get` followed by an `update`. The field values you specify replace the existing values. Fields that you don't specify in the request remain unchanged. Array fields, if specified, overwrite the existing arrays; this discards any previous array elements.\n[Try it now](#try-it).\n\nRequest\n-------\n\n### HTTP request\n\n```\nPATCH https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId\n```\n\n### Parameters\n\n| Parameter name | Value | Description |\n|-------------------------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Path parameters** |||\n| `calendarId` | `string` | Calendar identifier. To retrieve calendar IDs call the [calendarList.list](/workspace/calendar/api/v3/reference/calendarList/list) method. If you want to access the primary calendar of the currently logged in user, use the \"`primary`\" keyword. |\n| `eventId` | `string` | Event identifier. |\n| **Optional query parameters** |||\n| `alwaysIncludeEmail` | `boolean` | Deprecated and ignored. A value will always be returned in the `email` field for the organizer, creator and attendees, even if no real email address is available (i.e. a generated, non-working value will be provided). |\n| `conferenceDataVersion` | `integer` | Version number of conference data supported by the API client. Version 0 assumes no conference data support and ignores conference data in the event's body. Version 1 enables support for copying of ConferenceData as well as for creating new conferences using the createRequest field of conferenceData. The default is 0. Acceptable values are `0` to `1`, inclusive. |\n| `maxAttendees` | `integer` | The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned. Optional. |\n| `sendNotifications` | `boolean` | Deprecated. Please use [sendUpdates](/workspace/calendar/api/v3/reference/events/update#sendUpdates) instead. Whether to send notifications about the event update (for example, description changes, etc.). Note that some emails might still be sent even if you set the value to `false`. The default is `false`. |\n| `sendUpdates` | `string` | Guests who should receive notifications about the event update (for example, title changes, etc.). \u003cbr /\u003e \u003cbr /\u003e Acceptable values are: - \"`all`\": Notifications are sent to all guests. - \"`externalOnly`\": Notifications are sent to non-Google Calendar guests only. - \"`none`\": No notifications are sent. For calendar migration tasks, consider using the [Events.import](/workspace/calendar/api/v3/reference/events/import) method instead. |\n| `supportsAttachments` | `boolean` | Whether API client performing operation supports event attachments. Optional. The default is False. |\n\n### Authorization\n\nThis request requires authorization with at least one of the following scopes:\n\n| Scope |\n|---------------------------------------------------------|\n| `https://www.googleapis.com/auth/calendar` |\n| `https://www.googleapis.com/auth/calendar.events` |\n| `https://www.googleapis.com/auth/calendar.app.created` |\n| `https://www.googleapis.com/auth/calendar.events.owned` |\n\nFor more information, see the [authentication and authorization](/workspace/guides/configure-oauth-consent) page.\n\n### Request body\n\nIn the request body, supply the relevant portions of an [Events resource](/workspace/calendar/api/v3/reference/events#resource), according to the rules of patch semantics.\n\nResponse\n--------\n\nIf successful, this method returns an [Events resource](/workspace/calendar/api/v3/reference/events#resource) in the response body.\n\nTry it!\n-------\n\n\nUse the APIs Explorer below to call this method on live data and see the response."]]