我最近注意到使用 .NET 的重复周期停止工作(不确定是否在其他语言库中停止工作)。
代码完美运行了一年多,但突然间它没有保存重复周期,它保存了事件,但作为单个实例,这是一段代码,使用 OAuth2,非常简单(重复规则来自在 Google 中创建的事件,所以没有错误), 此代码保存事件而不重复:
Google.Apis.Calendar.v3.Data.Event entry = new Google.Apis.Calendar.v3.Data.Event();
string recurrenceRule = "RRULE:FREQ=DAILY;UNTIL=20130906T222536Z";
entry.Summary = "Test RO2";
entry.Description = "from prototype2";
entry.Location = "Home2";
// Dummy start and end datetime, timezone GMT -4 (my timezone)
string startTime = String.Format("{0:s}", DateTime.Now);
string endTime = String.Format("{0:s}", DateTime.Now.AddMinutes(30));
EventDateTime starting = new EventDateTime() {
DateTime = startTime,
TimeZone = "America/La_Paz"
};
EventDateTime ending = new EventDateTime()
{
DateTime = endTime,
TimeZone = "America/La_Paz"
};
entry.Start = starting;
entry.End = ending;
entry.Recurrence = new List<string>(){
recurrenceRule
};
entry.OriginalStartTime = starting;
// The event is saved, but it returns with no recurrence and no exception
Google.Apis.Calendar.v3.Data.Event eventCreated = _service.Events.Insert(entry, calendarId).Fetch();
如果有人知道修复或解决方法,如果您与其他库(PHP,Ruby,Python,Java等)有相同的问题,请告诉我
碰巧这一行:
entry.OriginalStartTime = starting;
搞砸了所有的重复出现,删除那条线解决了问题,不知道为什么,谷歌API几乎是一个黑洞,因为它们缺乏支持,过时的guis和无用的样本。