I think this is a fairly simple issue but I've been unable to find a
workaround for it (some of the posts come close, but nothing seems to
quite solve what I'm experiencing). I get a redirect exception when
running this code
//Create the query
FeedQuery query = new FeedQuery();
Service service = new Service("cl",
"exampleCo-exampleApp-1");
//Set the login credentials
NetworkCredential nc = new
NetworkCredential("[EMAIL PROTECTED]", "MYPASSWORD");
service.Credentials = nc;
//Create the query object
query.Uri = new
Uri("http://www.google.com/calendar/feeds/[EMAIL PROTECTED]/private/full");
//Tell the service to query
AtomFeed calFeed = service.Query(query);
//Add the appointment
AtomEntry entry = new AtomEntry();
AtomPerson author = new AtomPerson(AtomPersonType.Author);
author.Name = "David Klemke";
author.Email = "[EMAIL PROTECTED]";
entry.Title.Text = gTitle.Text;
entry.Content.Content = "Test appointment";
Uri postUri = query.Uri;
try
{
AtomEntry insertedEntry = service.Insert(postUri,
entry); // Exception comes from here but is never caught.
}
catch (Google.GData.Client.GDataRequestException ex)
{
MessageBox.Show(ex.ToString());
}
Exception is generated:
Google.GData.Client.GDataRedirectException occurred
Message="Execution resulted in a redirect from
http://www.google.com/calendar/feeds/[EMAIL PROTECTED]/private/full"
Source="Google.GData.Client"
ResponseString="<HTML>\n<HEAD>\n<TITLE>Moved
Temporarily</TITLE>\n</HEAD>\n<BODY BGCOLOR=\"#FFFFFF\"
TEXT=\"#000000\">\n<H1>Moved Temporarily</H1>\nThe document has moved
<A
HREF=\"http://www.google.com/calendar/feeds/[EMAIL
PROTECTED]/private/full?gsessionid=F0_qTl_biRA\">here</A>.\n</BODY>\n</HTML>\n>Moved
Temporarily</TITLE>\n</HEAD>\n<BODY BGCOLOR=\"#FFFFFF\"
TEXT=\"#000000\">\n<H1>Moved Temporarily</H1>\nThe document has moved
<A
HREF=\"http://www.google.com/calendar/feeds/[EMAIL
PROTECTED]/private/full?gsessionid=F0_qTl_biRA\">here</"
Location="http://www.google.com/calendar/feeds/[EMAIL
PROTECTED]/private/full?gsessionid=F0_qTl_biRA"
StackTrace:
at Google.GData.Client.GDataRequest.Execute() in C:\Documents
and Settings\Dave\Desktop\clients\cs\src\core\request.cs:line 434
So far I've tried changing the URI to https:// but that didn't change
anything. I've also seen some people reporting problems with an older
version of the API, but mines the latest and the exception throwing
code was in the right order (apparently it used to be in a different
order, causing my problem) as below:
if (response.StatusCode == HttpStatusCode.Redirect ||
response.StatusCode == HttpStatusCode.Found ||
response.StatusCode ==
HttpStatusCode.RedirectKeepVerb)
{
Tracing.TraceMsg("throwing for redirect");
throw new GDataRedirectException("Execution
resulted in a redirect from " + this.targetUri.ToString(),
this.webResponse);
}
if (request.Method == HttpMethods.Delete &&
response.StatusCode != HttpStatusCode.OK)
{
Tracing.TraceCall("GDataRequest::Deletion returned
unxepected result: " + response.StatusCode.ToString());
throw new GDataRequestException("Execution of
DELETE returned unexpected result: " + this.targetUri.ToString(),
this.webResponse);
}
I'm not exactly sure why I can't grab this exception and just handle it
(which would be easy enough) or what to do about it.
Any help is appreciated.
Cheers,
Dave
--~--~---------~--~----~------------~-------~--~----~
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://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---