Domanda

I recently noticed that recurrence using .NET stopped working (not sure if stopped working in other languages libraries).

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:

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)

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top