Can';t在C#和谷歌电子表格api中连接

Can';t在C#和谷歌电子表格api中连接,c#,google-sheets,C#,Google Sheets,试图使用他们的api访问google电子表格。按照他们的例子,代码不起作用,原因也不明显。我所要做的就是连接,我不断地返回相同的错误。这是他们从2010年4月15日起设置的代码。有人能就我做错了什么提出建议吗? 代码: 当我运行此命令时,它在myService.Query语句中不断出错,错误如下: Google.GData.Client.GDataRequestException was unhandled Message=Execution of request failed: http:

试图使用他们的api访问google电子表格。按照他们的例子,代码不起作用,原因也不明显。我所要做的就是连接,我不断地返回相同的错误。这是他们从2010年4月15日起设置的代码。有人能就我做错了什么提出建议吗? 代码:

当我运行此命令时,它在myService.Query语句中不断出错,错误如下:

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: 
Google.GData.Client.GDataRequestException未处理
消息=执行请求失败:http://spreadsheets.google.com/feeds/spreadsheets/private/full
Source=Google.GData.Client
责任预算=
找不到
找不到
错误404
堆栈跟踪:
在Google.GData.Client.GDataRequest.Execute()上
在Google.GData.Client.gdataAuthRequest.Execute(Int32 retryCounter)中
在Google.GData.Client.gdataAuthRequest.Execute()中
在Google.GData.Client.Service.Query(uriqueryuri、DateTime-ifModifiedSince、String-etag、Int64和contentLength)
在Google.GData.Client.Service.Query(uriqueryuri,DateTime-ifModifiedSince)
在Google.GData.Client.Service.Query(FeedQuery)
位于Google.GData.Spreadsheets.SpreadsheetsService.Query(电子表格查询feedQuery)
位于C:\Development Items\VS Projects\VS2008\google\u spreadsheet\google\u spreadsheet\Program.cs中的google\u spreadsheet.Program.Main(字符串[]args)处:第21行
位于System.AppDomain.\u nexecutestAssembly(程序集,字符串[]args)
在Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()上
在System.Threading.ExecutionContext.Run(ExecutionContext ExecutionContext,ContextCallback回调,对象状态)
位于System.Threading.ThreadHelper.ThreadStart()处
InnerException:System.Net.WebException
Message=远程服务器返回错误:(404)未找到。
来源=系统
堆栈跟踪:
在System.Net.HttpWebRequest.GetResponse()中
在Google.GData.Client.GDataRequest.Execute()上
内部异常:
然而,我可以使用url 然后用我的用户名/密码手动输入,就可以了。有什么建议吗? 谢谢
洛基·桑德斯(rocky sanders)

我对单声道(Mono)有点不舒服。在我的例子中,SSL使用的证书有问题

我认为这是因为在文档查询对象中没有指定Uri 试试这个

DocumentsService service = new DocumentsService("appName");
service.Credentials = new GDataCredentials("email@gmail.com", "password");

DocumentQuery query = new DocumentQuery("http://docs.google.com/feeds/default/private/full/-/contents");
query.Categories.Add(DocumentsListQuery.SPREADSHEETS);

var spreadsheets = service.Query(query).Entries.Cast<DocumentEntry>();
DocumentsService服务=新的DocumentsService(“appName”);
service.Credentials=新的GDataCredentials(“email@gmail.com“,”密码“);
DocumentQuery=新建DocumentQuery(“http://docs.google.com/feeds/default/private/full/-/contents");
query.Categories.Add(DocumentsListQuery.SPREADSHEETS);
var电子表格=service.Query(Query.Entries.Cast();

尝试使用SSL访问它们。这可能是工作。
DocumentsService service = new DocumentsService("appName");
service.Credentials = new GDataCredentials("email@gmail.com", "password");

DocumentQuery query = new DocumentQuery("http://docs.google.com/feeds/default/private/full/-/contents");
query.Categories.Add(DocumentsListQuery.SPREADSHEETS);

var spreadsheets = service.Query(query).Entries.Cast<DocumentEntry>();