I have create the following code to insert calender in google using C#
ASP.NET. But it throws error.
CalendarService service = new CalendarService("Eric Carpenter1");
service.setUserCredentials("[email protected] <[email protected]>",
"************");
Uri postUri;
postUri = new Uri("
http://www.google.com/calendar/feeds/default/owncalendars/full");
CalendarEntry calendar = new CalendarEntry();
calendar.Title.Text = "Calender for Project 1";
calendar.Summary.Text = "This calendar contains project for the month.";
calendar.TimeZone = "Astana/Dhaka";
calendar.Hidden = false;
calendar.Color = "#2952A3";
calendar.Location = new Where("", "", "Oakland");
CalendarEntry createdCalendar = (CalendarEntry)service.Insert(postUri,
calendar);
It throws
Google.GData.Client.GDataRequestException: Execution of request failed:
http://www.google.com/calendar/feeds/default/owncalendars/full?gsessionid=F1-PtA8r-cZy6FNIK5tYdg--->
System.Net.WebException: The remote server returned an error: (400) Bad
Request.
at System.Net.HttpWebRequest.GetResponse()
at Google.GData.Client.GDataRequest.Execute()
--- End of inner exception stack trace ---
at Google.GData.Client.GDataRequest.Execute()
at Google.GData.Client.GDataGAuthRequest.Execute(Int32 retryCounter)
at Google.GData.Client.GDataGAuthRequest.Execute()
at Google.GData.Client.Service.EntrySend(Uri feedUri, AtomBase baseEntry,
GDataRequestType type, AsyncSendData data)
at Google.GData.Client.Service.Insert(Uri feedUri, AtomEntry newEntry,
AsyncSendData data)
at Google.GData.Client.Service.Insert[TEntry](Uri feedUri, TEntry entry)
at PD.ProjectCalender.lnkPush_Click(Object sender, EventArgs e) in
g:\WFolder\Projects\Demo\Eric Carpenter\Source\ProjectCalender.aspx.cs:line
802
But I can get calenders by this uri and credentials.
Please help me if you can.
Thanks,
--
You received this message because you are subscribed to the Google
Groups "Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/calendar/community/forum.html