【发布时间】:2022-08-14 13:50:25
【问题描述】:
我以this github code 为例,使用服务帐户在工作区日历中创建谷歌日历事件。
我遵循了有关如何使用服务帐户进行身份验证和连接的各种示例,现在我能够创建一个事件,并且它也成功显示在工作区日历中。
但是,返回的事件没有我可以从中获取 \'conferenceId\' 以创建 google meet 链接的 \'conferenceData\'。
下面是我使用的插入代码,它有效但不返回所述会议数据。
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\');
}
}
});
这是我打印到控制台的输出:
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 的任何建议?
*** 编辑 ****
在我四处挖掘时出现了其他东西:
虽然这对我的用例无关紧要,但 google api 不允许我添加与会者 - 即使它是服务帐户电子邮件 ID。
创建事件DetailedApiRequestError时出错(状态:403,消息: 服务帐户无法邀请没有域范围的与会者 权力下放。)
我不明白,已经为此帐户完成了域范围的委派,这就是为什么我能够首先进行身份验证并创建日历事件。
我的理解错了吗?
标签: flutter google-calendar-api