使用Google Calendar API预订资源未同步至资源日历问题排查
问题分析:Google Calendar API添加资源后资源日历无会议显示
可能的原因及解决方案
时区配置冲突
请求里start.dateTime用的是-07:00(太平洋时区),但timeZone设为America/New_York(东部时区),时区不匹配会导致资源日历解析时间出错,进而跳过显示。需确保dateTime的时区偏移与timeZone一致:要么把dateTime改成对应纽约夏令时的2024-05-01T11:30:00-04:00,要么让dateTime不带偏移(如2024-05-01T08:30:00),由API自动处理时区转换。资源参会者的
responseStatus手动赋值问题
你手动将资源的responseStatus设为accepted,但API创建会议时,资源的参会状态需要系统自动确认,而非手动指定。去掉该字段,让资源日历自行处理响应,才能确保会议被添加到资源日历中。iCalUID重复冲突
自定义的iCalUID若在资源日历中已存在冲突事件,会导致新会议被忽略。建议删除该字段,让API自动生成唯一UID,避免重复问题。权限不足
检查调用API的账号是否拥有写入资源日历的权限,而非仅能创建会议。确认账号的Calendar API权限范围包含https://www.googleapis.com/auth/calendar(全权限),而非只读或受限权限;若权限不足,需调整账号权限或换用有权限的账号测试。
修正后的请求JSON示例
{ "summary": "Test API event", "extendedProperties": { "private": { "JeffCreated": "yes" } }, "description": "", "location": "Seattle Main Conference Room", "start": { "dateTime": "2024-05-01T11:30:00", "timeZone": "America/New_York" }, "end": { "dateTime": "2024-05-01T12:00:00", "timeZone": "America/New_York" }, "reminders": { "useDefault": false, "overrides": [ { "method": "popup", "minutes": 15 } ] }, "attendees": [ { "email": "jsnuffy@testdomain.com", "resource": false, "optional": false, "responseStatus": "needsAction" }, { "email": "Jason@testdomain.com", "resource": false, "optional": true, "responseStatus": "needsAction" }, { "email": "tmglgapps.com_3435383633373331313633@resource.calendar.google.com", "resource": true, "optional": false } ], "visibility": "default" }
内容的提问来源于stack exchange,提问作者Jeff McKay
相关产品推荐
相关产品推荐

