I need to create a event in a public calendar wit asp.net I search a lot of examples but none of them helped with my question. Please look at the following code, he has no errors but don't add the event to google calendar. Any help will be appreciated.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Google.Apis.Calendar;
using Google.Apis.Calendar.v3.Data;
using Google.Apis.Calendar.v3;
using Google.Apis.Services;
public partial class google : System.Web.UI.Page
{
private object ddlCalendars;
public IClientService Calendar_Service { get; private set; }
protected void Page_Load(object sender, EventArgs e)
{
Event evnt = new Event();
evnt.Summary = "Evento criado por programa";
evnt.Location = "Coimbra";
evnt.Description = "Este evento foi criado por programa";
EventDateTime startTime = new EventDateTime() { DateTime = DateTime.ParseExact("05/04/2017 10:00:00", "dd/MM/yyyy HH:mm:ss", null) };// new EventDateTime();
EventDateTime endTime = new EventDateTime() { DateTime = DateTime.ParseExact("05/04/2017 11:00:00", "dd/MM/yyyy HH:mm:ss", null) }; // new EventDateTime();
evnt.Start = startTime;
evnt.End = endTime;
EventAttendee ea = new EventAttendee();
ea.DisplayName = "Mario";
ea.Email = "myemail";
ea.Organizer = false;
ea.Resource = false;
IList<EventAttendee> lstOfAtendee = new List<EventAttendee>();
lstOfAtendee.Add(ea);
evnt.Attendees = lstOfAtendee;
EventsResource er = new EventsResource(Calendar_Service);
er.Insert(evnt, ea.ToString());
}
}