簡體   English   中英

Flutter 應用程序 + Google 日歷 API:events.insert 未返回“會議數據”

[英]Flutter App + Google Calendar API : events.insert not returning 'conferenceData'

我以這個 github 代碼為例,使用服務帳戶在工作區日歷中創建谷歌日歷事件。

我遵循了有關如何使用服務帳戶進行身份驗證和連接的各種示例,現在我能夠創建一個事件,並且它也成功顯示在工作區日歷中。

但是,返回的事件沒有“conferenceData”,我可以從中獲取“conferenceId”來創建 google meet 鏈接。

下面是我使用的插入代碼,它有效但不返回所述會議數據。

       await calendar.events.insert(event, calendarId,
              conferenceDataVersion: 1, sendUpdates: "none")
          .then((value) {
            print("Event Status: ${value.status}");
            if (value.status == "confirmed") {
              print(value.toJson().toString());
              String joiningLink;
              String eventId;

              eventId = value.id; 
              joiningLink = "https://meet.google.com/${value.conferenceData?.conferenceId}";
            
              print('Event added to Google Calendar : $joiningLink');
            }
           }
          });

這是我打印到控制台的 output:

I/flutter ( 2934): Event Status: confirmed
I/flutter ( 2934): {created: 2022-07-26T16:12:20.000Z, creator: Instance of 'EventCreator', description: xxxx-desc, end: Instance of 'EventDateTime', etag: "3317703881666000", eventType: default, htmlLink: https://www.google.com/calendar/event?eid=djc1b2gyY3RzZ2p1YWGo4aWtmdWIydG5pZ3R2aGNvNEBn, iCalUID: v75oh2ctsgjuahtircv@google.com, id: v75oh2ctv7itndnc, kind: calendar#event, location: Google Meet, organizer: Instance of 'EventOrganizer', reminders: Instance of 'EventReminders', sequence: 0, start: Instance of 'EventDateTime', status: confirmed, summary: xxxxxxx, updated: 2022-07-26T16:12:20.833Z}
I/flutter ( 2934): Event added to Google Calendar : https://meet.google.com/null

關於如何獲取會議數據和會議 ID 的任何建議?

*** 編輯 ****

在我四處挖掘時出現了其他東西:

雖然這對我的用例無關緊要,但谷歌 api 不允許我添加與會者 - 即使它是服務帳戶 email id。

創建事件DetailedApiRequestError時出錯(狀態:403,消息:服務帳戶無法邀請沒有全域授權的與會者。)

我不明白,已經為此帳戶完成了域范圍的委派,這就是為什么我能夠首先進行身份驗證並創建日歷事件。

我的理解錯了嗎?

我發現這個答案可以讓你朝着正確的方向前進。 您需要在insert()方法中添加conferenceData.createRequest值,以便從新活動中獲取 Google Meet 鏈接。

關於與域范圍委派相關的錯誤:

當服務帳戶未模擬 Google Workspace 組織中的任何用戶時,預計會出現此錯誤,您可以查看 Google Developers 的“委派域范圍權限”下的此部分,並嘗試更新代碼以模擬其他用戶. 環顧四周,我發現您的案例中使用服務帳戶時可以使用的可選參數是impersonatedUser

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM