如何生成同一个Google Meet链接用于多个Google日历的活动
实现方案
核心逻辑:每次调用日历事件创建接口时如果开启自动生成Meet配置,Google Calendar会为每个独立事件单独生成会议链接,因此只需先生成1个带Meet链接的主事件,提取固定的会议数据后复用给另外两个日历的事件即可,避免多次生成新链接。
操作步骤
- 第一步:开启Apps Script的Calendar Advanced Service
打开脚本编辑器,点击左侧「服务」→ 找到并添加「Calendar API」v3版本,才能调用支持会议数据配置的接口。 - 第二步:创建首个日历事件并提取统一Meet数据
调用Calendar.Events.insert()创建第一个日历时,配置自动生成Meet的参数,创建完成后从返回的事件对象中提取完整的conferenceData字段,里面包含固定的Meet链接信息。 - 第三步:剩余两个日历创建事件时复用会议数据
创建后两个事件时,不要开启自动生成Meet的参数,直接把上一步提取的conferenceData赋值给新事件的对应字段,提交时指定conferenceDataVersion: 1即可复用同一个Meet链接。
示例代码
function createUnifiedMeetEvents() { // 替换为你自己的三个日历ID const CALENDAR_IDS = [ 'calendar1@group.calendar.google.com', 'calendar2@group.calendar.google.com', 'calendar3@group.calendar.google.com' ]; // 这里替换为你从Spreadsheet读取活动信息的逻辑 const eventData = { title: '跨日历统一会议', startTime: new Date('2024-06-01T10:00:00'), endTime: new Date('2024-06-01T11:00:00'), desc: '所有参会人共用同一个Meet链接' }; // 1. 创建第一个日历事件,生成唯一Meet链接 const firstEventParams = { summary: eventData.title, start: { dateTime: eventData.startTime.toISOString() }, end: { dateTime: eventData.endTime.toISOString() }, description: eventData.desc, conferenceData: { createRequest: { requestId: Utilities.getUuid(), conferenceSolutionKey: { type: 'hangoutsMeet' } } } }; const firstEvent = Calendar.Events.insert(firstEventParams, CALENDAR_IDS[0], { conferenceDataVersion: 1 }); // 提取统一的会议数据 const unifiedConference = firstEvent.conferenceData; // 2. 给剩余两个日历创建事件,复用会议数据 for (let i = 1; i < CALENDAR_IDS.length; i++) { const otherEventParams = { summary: eventData.title, start: { dateTime: eventData.startTime.toISOString() }, end: { dateTime: eventData.endTime.toISOString() }, description: eventData.desc, conferenceData: unifiedConference }; Calendar.Events.insert(otherEventParams, CALENDAR_IDS[i], { conferenceDataVersion: 1 }); } }
注意事项
- 如果你的日历默认开启了「自动添加Google Meet会议」,创建后两个事件时可以额外添加
guestsCanModify: false配置,避免系统自动生成新链接覆盖手动配置的统一链接。 - 三个事件可以分别添加对应日历的参会人,不会影响Meet链接的有效性,所有参会人都可以进入同一场会议。
- 如需后续同步修改/取消三个事件,可以把三个事件的ID存在对应Spreadsheet行的空白列里,方便后续批量操作。
内容的提问来源于stack exchange,提问作者Johnno
相关产品推荐
相关产品推荐

