简体   繁体   English

.NET Google Calendar API V3重复不起作用

[英].NET Google calendar api v3 recurrence not working

I recently noticed that recurrence using .NET stopped working (not sure if stopped working in other languages libraries). 我最近注意到,使用.NET的重复发生已停止工作(不确定是否已在其他语言库中停止工作)。

The code was working perfectly for more than a year, but all out of sudden it does not save the recurrence, it saves the event but as single instance, here is a piece of code, using OAuth2, very straightforward (the recurrence rule is from an event created within Google, so there is no mistake on that), this code saves the event without recurrence: 该代码可以正常运行一年以上,但是突然之间,它不能保存重复发生,可以保存事件,但是作为单个实例,这是一段使用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();

Please let me know if someone knows a fix or workaround, also if you have same problem with other libraries (PHP, Ruby, Python, Java, etc) 如果有人知道修复程序或解决方法,以及其他库(PHP,Ruby,Python,Java等)是否存在相同问题,请告诉我

Happens that this line: 发生此行:

entry.OriginalStartTime = starting;

Was messing all the recurrence, erasing that line solved the problem, dont know why, google API are almost a black hole due their lack of support, outdated guis and useless samples. 搞砸了所有重复发生,删除了该行即可解决问题,不知道为什么,由于缺少支持,过时的GUI和无用的示例,Google API几乎是一个黑洞。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM