Insert Entry to Calendar and 400 Bad request

363 views
Skip to first unread message

lada_vyvojar

unread,
Mar 1, 2012, 9:01:37 AM3/1/12
to google-ca...@googlegroups.com
Hi,
I need to solve the problem:
 
The assembly written in C # Google.GData.Calendar.CalendarService service call.

- Authorization -
Create an instance of Google.GData.Client.GAuthSubRequestFactory.
This instance, set the active token token.

The properties Google.GData.Calendar.CalendarService.RequestFactory
assign instance Google.GData.Client.GAuthSubRequestFactory.

- Creating a calendar event -
Create an instance of the class and set up her Google.GData.Calendar.EventEntry
necessary data.

- Added events to the calendar -
Calling method Google.GData.Calendar.CalendarService.Insert (posturi, entry).
where
Posturi: Uri my calendar: https://www.google.com/calendar/feeds/ [email] / private / full
Note: Google.GData.Calendar.EventEntry
    
---
Google.GData.Calendar.CalendarService.Insert method () returns the message:
   
Google.GData.Client.GDataRequestException was caught
Message = Execution of request failed: @ https://www.google.com/calendar/feeds/[email]/ private / full
Source = Google.GData.Client
ResponseString = Character reference "& #
StackTrace:
Google.GData.Client.GDataRequest.Execute at ()
at Google.GData.Client.GDataGAuthRequest.Execute (Int32 retryCounter)
at Google.GData.Client.GDataGAuthRequest.Execute (Int32 retryCounter)
at Google.GData.Client.GDataGAuthRequest.Execute (Int32 retryCounter)
at Google.GData.Client.GDataGAuthRequest.Execute (Int32 retryCounter)
Google.GData.Client.GDataGAuthRequest.Execute at ()
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)
InnerException: System.Net.WebException
Message = The remote server returned an error: (400) Bad Request.
Source = System
StackTrace:
System.Net.HttpWebRequest.GetResponse at ()
Google.GData.Client.GDataRequest.Execute at ()
InnerException:

What is the cause and how to solve?
 
Source code:
/ /
GAuthSubRequestFactory authFactory GAuthSubRequestFactory = new ("cl", "Komtesa-Eso9LibKomt-1");
authFactory.Token = p_token;

/ / Google calendar
service = new CalendarService (authFactory.ApplicationName);

/ / Make the request
service.RequestFactory = authFactory;

/ / Google Calendar event
EventEntry EventEntry entry = new ();
/ / Event title
entry.Title.Text = title;
/ / The event
entry.Content.Content = content;
/ / Date
When eventtime = new When (dtskutterm, dtskutterm, true);
entry.Times.Add (eventtime);

/ / Identification Google Calendar
string strURL = "https://www.google.com/calendar/feeds/" p_email + + "/ private / full";
/ / Transfer to URI identification
Uri = new Uri posture (strURL);
string = string.Empty Edituri;

/ / Based events to Google calendar
AtomEntry insertedEntry service.Insert = (posture, entry);
 
Thank you for your answer.

Dan B

unread,
Mar 2, 2012, 9:26:10 AM3/2/12
to google-ca...@googlegroups.com
Hi,
 
 I had similiar problems using Calendar v3. If you are using v3 I might take a look at the event time stuff. I know that for me I started being able to insert events when I made some changes to the way I formatted the start and end dates.
 
 
This page explains more.
Reply all
Reply to author
Forward
0 new messages