I can not Create a reminder in Google Api Calendar from C #, always put the reminder by default, and send it in False (UseDefault = false,)

0
public Boolean CrearEvento(Eventos_ENT obj_evento)
    {
        try
        {
            UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                            new ClientSecrets
                            {
                                ClientId = "Mi id Cliente",
                                ClientSecret = "Mi Cliente Secret",
                            },
                            new[] { CalendarService.Scope.Calendar },
                            "user",
                            CancellationToken.None).Result;

            // Create the service
            var service = new CalendarService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = "Calendar API Sample",
            });
            Event myEvent = new Event
            {
                //Summary = "Appointment",
                //Location = "Somewhere",
                Summary = obj_evento.titulo_ev,
                Location = obj_evento.ubicacion_ev,
                Description = obj_evento.descripcion_eve,
                HangoutLink = "",
                Start = new EventDateTime()
                {
                    //DateTime = new DateTime(2018, 7, 20, 10, 0, 0),
                    DateTime = obj_evento.FechaInicio,
                    TimeZone = obj_evento.TimeZone
                },
                End = new EventDateTime()
                {
                    //DateTime = new DateTime(2018, 7, 21, 10, 30, 0),
                    DateTime = obj_evento.FechaFin,
                    TimeZone = obj_evento.TimeZone
                },
                Reminders = new Event.RemindersData()
                {
                    UseDefault = false,
                    Overrides = new EventReminder[]
                    {
                        new EventReminder (){ Method="email", Minutes=24*60}
                    }
                },
                Recurrence = new String[] {
                  //"RRULE:FREQ=WEEKLY;BYDAY=MO"
                  obj_evento.Recurrencia
              },

                Attendees = obj_evento.Email.Select(m => new EventAttendee() { Email = m.Email,DisplayName=m.Nombre+" "+m.Apellido,ResponseStatus= "accepted" }).ToList(),
            };
            Event recurringEvent = service.Events.Insert(myEvent, "primary").Execute();
            return true;
        }
        catch (Exception ex)
        {
            return false;
        }

    }
    
asked by Maikol Martinez 19.07.2018 в 17:25
source

0 answers