【问题标题】:Bad Request when querying revisions查询修订时的错误请求
【发布时间】:2012-05-10 16:57:04
【问题描述】:

我正在尝试按照this post 中的说明进行操作,但我无法使其工作。

RevisionQuery 的构造函数接受一个字符串,但 entry.RevisionDocument 是一个 Uri。我刚刚使用了 .ToString(),但现在出现错误 - 远程服务器返回错误:(400) 错误请求 - 当我尝试执行查询时 (RevisionFeed revisions = service.Query(revisionQuery))。 Uri 设置为http://docs.google.com/feeds/default/private/full/document:{id}/revisions。这是从文档中获取修订的正确 Uri 吗?当我在浏览器中访问 url 时,我得到了同样的错误。

我相信我已经使用正确的凭据设置了我的服务,但我确定我只是遗漏了一些小东西。任何帮助将不胜感激。我有许多文档需要发布,而手动完成它们会很痛苦。

谢谢!

【问题讨论】:

    标签: .net google-docs google-docs-api


    【解决方案1】:

    属性entry.RevisionDocument其实是一个字符串:

    http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/src/documents3/documententry.cs#373

    可以在 RevisionQuery 构造函数中使用,如https://developers.google.com/google-apps/documents-list/#managing_revisions_of_documents_and_files 的文档中所示,以及以下 sn-p:

    RevisionQuery revisionQuery = new RevisionQuery(entry.RevisionDocument);
    RevisionFeed revisions = service.Query(revisionQuery);
    

    【讨论】:

    • 我知道我做错了什么。我没有使用 Google.Data.Documents.DocumentEntry,而是使用 Google.Documents.Document 作为我的条目。在该对象中,RequestDocument 是一个 Uri,但在 DocumentEntry 中我可以看到它是一个字符串。我知道我错过了一些小东西。我将重构我的代码以使用服务/查询模型而不是 DocumentRequest 模型,看看会发生什么。非常感谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-14
    • 2020-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-24
    相关资源
    最近更新 更多