【问题标题】:Google DocumentsList API - programmatically setting the DescriptionGoogle DocumentsList API - 以编程方式设置描述
【发布时间】:2012-06-06 14:28:11
【问题描述】:

背景

我目前正在使用 Google Drive/Docs 实现一个应用程序。我正在使用最新的 .NET library for Google Data APIs 库上传图片,并利用 Google Drive 作为图片库。

问题

我希望能够设置与 Google 云端硬盘中的每个项目关联的描述字段。上传工作正常,我无法让描述字段工作。

我可以看到 post 中提到的修改已集成到最新的库中,因此 DocumentEntry 类现在有一个 Description 成员。

将此新成员设置为文本时,在将文件插入 Google 云端硬盘时会引发 (400) Bad Request 错误。完整的错误是:

<errors xmlns='http://schemas.google.com/g/2005'>
    <error>
        <domain>GData</domain>
        <code>ParseException</code>
        <internalReason>[Line 3, Column 42, element docs:description] Unknown attribute: 'value' </internalReason>
    </error>
    <error>
        <domain>GData</domain>
        <code>ParseException</code>
        <internalReason>Unknown attribute: 'value' </internalReason>
    </error>
</errors>

我尝试过使用.Summary.Content.Content,但没有结果。代码作为我想要实现的示例:

 DocumentEntry entry = new DocumentEntry();

 entry.Title.Text = "Test Upload";
 entry.Description = "Tag1, Tag2"; // Once I set this I get the error
 entry.Summary.Text = "Tag3, Tag 4"; // This doesn't do anything!

问题

任何有关人们这样做或之前研究过的经验的帮助将不胜感激。

有人成功实现了这个功能吗?或者,是客户端无法控制的 Google API 的限制?

【问题讨论】:

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


    【解决方案1】:

    docs:description 元素不再接受其值作为属性:

    <docs:description value="Tag1 Tag2" />
    

    相反,该值必须作为元素的内容传递:

    <docs:description>Tag1, Tag2</docs:description>
    

    .NET 库自 rev. 起已修复。 1196:

    http://code.google.com/p/google-gdata/source/detail?r=1196

    请检查最新的来源并重试。

    【讨论】:

    • 非常感谢克劳迪奥。我检查了最新的库源代码,已编译,现在一切正常。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-23
    • 2015-04-09
    • 1970-01-01
    • 2012-10-02
    • 1970-01-01
    • 1970-01-01
    • 2022-08-09
    相关资源
    最近更新 更多