谷歌的API .NET SpreadSheet连接

时间:2011-10-15 16:48:16

标签: .net google-sheets

这是我的问题,我正在尝试用Google的SpreadSheet做一些事情。但我不明白“exampleCo-exampleApp-1”可能是什么以及在我的Google文档帐户中查找该信息的位置。

SpreadsheetsService service = new SpreadsheetsService("exampleCo-exampleApp-1");

我从该applicationName中理解的是,它以“Compagny”名称开头,后跟“Application”名称,并以某种版本完成?

----跟进---- 我认为“exampleCo-exampleApp-1”只是一个名称,我正在编写的应用程序的名称(需要确认)......

真正的问题是,每次我发出需要连接到服务器的命令时,它都会失败......

堆栈看起来像这样:

(当我这样做:service.Query(query);)

at Google.GData.Client.GDataRequest.Execute()
at Google.Gdata.Client.GDataGAuthRequest.Execute(Int32 retryCounter)
System.Exception: Error getting response stream (Write: The authentication or decryption has failed.):SendFailure
System.Exception: the authentication or decryption has failed.
System.Exception: Invalid certificate received from server. Error code: 0xffffffff800b010a

(当我这样做:service.QueryClientLoginToken();)

at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult)
at System.Net.HttpWebRequest.GetRequestStream()
at Google.GData.Client.Utilities.QueryClientLoginToken(Google.Gdata.Client.GDataCredentials gc, System.String serviceName, System.String applicationName, Boolean fUseKeepAlive, System.Uri clientLoginHandler)
System.Exception: The authentication or decryption has failed.
System.Exception: Invalid certificate received from server. Error code: oxffffffff800b010a

这是我的测试代码:

using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.Spreadsheets;

class MainClass
{
    public static void Main (string[] args)
    {           
        SpreadsheetsService service = new SpreadsheetsService("testAppName");
        service.setUserCredentials("xxxx@gmail.com", "xxxxx");

        string token = service.QueryClientLoginToken();
        Console.WriteLine("token = {0}", token);

        SpreadsheetQuery query = new SpreadsheetQuery();
        SpreadsheetFeed feed = service.Query(query);

        Console.WriteLine ("The spreadsheets List:");
        foreach(SpreadsheetEntry entry in feed.Entries)
        {
            Console.WriteLine("entry: " + entry.Title.Text);
        }

        Console.WriteLine ("The End!");
    }
}

感谢您的提示!

1 个答案:

答案 0 :(得分:2)

也许这与this issue

有关

我在Ubuntu 11.10上遇到了同样的问题,并通过在用户shell中键入mozroots --import --sync来修复它,以更新用过的服务器证书。