我搜索了又搜索,試圖找到這個問題的答案,但從我讀過的所有示例和答案中,我看不出我的問題是什么。我正在嘗試更新用戶選擇的一系列事件的擴展屬性。日歷事件的 ID(來自高級 API,而不是內置的 CalendarApp)在被選擇時存儲在數組中。然后,我將此數組傳遞給要循環的函數,并更新數組中標識的每個事件的擴展屬性。它根本不起作用,我只是null從patch調用中返回,甚至沒有我可以處理的錯誤。我的職能是:function updateLessonsStatus(arrCalIds){? try {? ? Logger.log(arrCalIds);? ? arrCalIds.forEach(function(row){? ? ? Logger.log(row);? ? ? var objEventPatch = {? ? ? ? "resource": {? ? ? ? ? "extendedProperties": {? ? ? ? ? ? "shared": {? ? ? ? ? ? ? "status": "accounted"? ? ? ? ? ? }? ? ? ? ? }? ? ? ? }? ? ? };? ? ? Logger.log(objEventPatch);? ? ? return Calendar.Events.patch(objEventPatch, "primary", row);? ? ? //return true;? ? });? }? catch(err) {? ? Logger.log(err);? ? throw err;? }}我也嘗試過objEventPatch按照 Google 日歷 API 補丁“嘗試此 API”參考https://developers.google.com/calendar/v3/reference/events/patch進行這樣的設置:? ? ? var objEventPatch = {? ? ? ? "calendarId": "primary",? ? ? ? "eventId": row,? ? ? ? "resource": {? ? ? ? ? "extendedProperties": {? ? ? ? ? ? "shared": {? ? ? ? ? ? ? "status": "accounted"? ? ? ? ? ? }? ? ? ? ? }? ? ? ? }? ? ? };我仍然從 Google Apps 腳本中得到 null。我可以使用“嘗試此 API”功能成功地使用我擁有的 IDget來處理事件。patchGoogle 文檔中很少有將高級 API 與 Google Apps 腳本結合使用的示例,我也找不到任何內容,patch因此我使用 Javascript 示例來構建到目前為止我所編寫的內容。有人可以幫助解決我做錯的事情嗎?(為了清晰起見,已更新并包含返回的記錄器輸出的圖像null)
如何在 Google Apps 腳本中使用 Calendar.Events.patch?
胡子哥哥
2023-07-29 16:08:08