Can't connect in C# and google spreadsheet api
Posted
by RockySanders99
on Stack Overflow
See other posts from Stack Overflow
or by RockySanders99
Published on 2010-06-04T18:32:58Z
Indexed on
2010/06/16
13:12 UTC
Read the original article
Hit count: 351
api
|google-spreadsheet
Trying to access google spreadsheets using their api. following their example, the code doesnt work, and its not obvious why. All I'm trying to do is to connect, and I keep getting back the same error. This is with their code set as of 4/15/10. Can anyone offer any suggestion on what I'm doing wrong? CodE:
using System;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.Spreadsheets;
namespace google_spreadsheet
{
class Program
{
static void Main(string[] args)
{
SpreadsheetsService myService = new SpreadsheetsService("MySpreadsheet" );
myService.setUserCredentials("[email protected]", "xxxxxxx");
string token1 = myService.QueryClientLoginToken();
Console.WriteLine("token is {0}", token1);
Console.ReadLine();
SpreadsheetQuery query = new SpreadsheetQuery();
SpreadsheetFeed feed = myService.Query(query);
Console.WriteLine("list");
foreach (SpreadsheetEntry entry in feed.Entries)
{
Console.WriteLine("Value: {0}", entry.Title.Text);
When I run this, it keeps erroring out at the myService.Query statement, with the following error:
Google.GData.Client.GDataRequestException was unhandled
Message=Execution of request failed: http://spreadsheets.google.com/feeds/spreadsheets/private/full
Source=Google.GData.Client
ResponseString=<HTML>
<HEAD>
<TITLE>Not Found</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Not Found</H1>
<H2>Error 404</H2>
</BODY>
</HTML>
StackTrace:
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.Query(Uri queryUri, DateTime ifModifiedSince, String etag, Int64& contentLength)
at Google.GData.Client.Service.Query(Uri queryUri, DateTime ifModifiedSince)
at Google.GData.Client.Service.Query(FeedQuery feedQuery)
at Google.GData.Spreadsheets.SpreadsheetsService.Query(SpreadsheetQuery feedQuery)
at google_spreadsheet.Program.Main(String[] args) in C:\Development Items\VS Projects\VS2008\google_spreadsheet\google_spreadsheet\Program.cs:line 21
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Net.WebException
Message=The remote server returned an error: (404) Not Found.
Source=System
StackTrace:
at System.Net.HttpWebRequest.GetResponse()
at Google.GData.Client.GDataRequest.Execute()
InnerException:
Yet, I can take the url http://spreadsheets.google.com/feeds/spreadsheets/private/full and manually type it in with my username/password, and it works fine. Any suggestions? thanks rocky sanders
© Stack Overflow or respective owner