首页 > 解决方案 > 由于不同的 eventId 格式,无法为在 iOS 上创建的事件加载带有 getEventByID 的日历事件

问题描述

我有一个包含事件列表的 Google 表格,每一行都包含 CalendarId 和 EventId。

一些 EventId 的格式不同。例如:

- usual format: 2nn755esk1ddgg8bf4efabq5i0@google.com
- different format: 4F29BF66-4264-44E9-9162-9E6B9B97AF53

当我尝试加载具有不同格式的事件时,我得到“null”而不是事件对象。

示例代码:

// event load returns null
var calendar1 = CalendarApp.getCalendarById('stepvda.net_qfrvg5ejjrv97ps04o16fjiokk@group.calendar.google.com');
var event1 = calendar1.getEventById('4F29BF66-4264-44E9-9162-9E6B9B97AF53'); 

// event code returns event object correctly
var calendar2 = CalendarApp.getCalendarById('stepvda.net_dunvv2cuqlirkucfamgj0vec18@group.calendar.google.com');
var event2 = calendar2.getEventById('2nn755esk1ddgg8bf4efabq5i0@google.com'); 

我注意到不同的 eventId 格式似乎来自我在 iPhone 上的 iOS 中创建的事件,其中正常格式是我在 Google 日历网络应用程序中创建的事件。

知道如何为 eventId 加载具有不同格式的事件吗?

标签: google-apps-scriptgoogle-calendar-api

解决方案


推荐阅读