將活動移到其他日曆,例如變更活動發起人。請注意,只能移動 default
事件;無法移動 outOfOffice
、focusTime
、workingLocation
和 fromGmail
事件。立即試用或參閱範例。
要求
HTTP 要求
POST https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId/move
參數
參數名稱 | 值 | 說明 |
---|---|---|
路徑參數 | ||
calendarId |
string |
活動所在來源日曆的日曆 ID。 |
eventId |
string |
事件 ID。 |
必要的查詢參數 | ||
destination |
string |
活動目標日曆的日曆 ID。 |
選用查詢參數 | ||
sendNotifications |
boolean |
已淘汰,請改用 sendUpdates。 是否要傳送活動發起人變更的相關通知。請注意,即使您將值設為 false ,系統仍可能傳送部分電子郵件。預設值為 false 。 |
sendUpdates |
string |
應收到活動主辦者變更通知的邀請對象。
可接受的值如下:
|
授權
這項要求至少需要取得下列其中一個範圍的授權:
內容範圍 |
---|
https://www.googleapis.com/auth/calendar |
https://www.googleapis.com/auth/calendar.events |
詳情請參閱「驗證和授權」網頁。
要求主體
請勿使用這個方法提供要求主體。
回應
如果成功的話,這個方法會在回應主體中傳回事件資源。
示例
注意:這個方法適用的程式語言眾多,我們只在此提供部分程式碼範例,完整的支援語言清單請參閱用戶端程式庫頁面。
Java
使用 Java 用戶端程式庫。
import com.google.api.services.calendar.Calendar; import com.google.api.services.calendar.model.Event; // ... // Initialize Calendar service with valid OAuth credentials Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credentials) .setApplicationName("applicationName").build(); // Move an event to another calendar Event updatedEvent = service.events().move('primary', "eventId", "destinationCalendarId").execute(); System.out.println(updatedEvent.getUpdated());
Python
使用 Python 用戶端程式庫。
# First retrieve the event from the API. updated_event = service.events().move( calendarId='primary', eventId='eventId', destination='destinationCalendarId').execute() # Print the updated date. print updated_event['updated']
PHP
使用 PHP 用戶端程式庫。
$result = $service->events->move('primary', 'eventId', 'destinationCalendarId'); // Print the updated date. echo $result->getUpdated();
Ruby
使用 Ruby 用戶端程式庫。
result = client.move_event('primary', 'eventId', 'destinationCalendarId') print result.updated
試試看!
使用下方的 APIs Explorer,針對有效資料呼叫這個方法,然後查看回應。