Search code examples
.netgoogle-docs-apigoogle-data-api

Google DocumentsList API - programmatically setting the Description


Background

I am currently implementing an application with Google Drive/Docs. Using the latest .NET library for Google Data APIs library I am uploading images, leveraging Google Drive as an image library.

Problem

I would like to be able to set the Description field associated with each item in Google Drive. The uploads work correctly, I can't get the Description field to work.

I can see the modification mentioned in this post has been integrated into the latest library so the DocumentEntry class now has a Description member.

When setting this new member to the text I want a (400) Bad Request error is thrown when Inserting the file in Google Drive. The full error is:

<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>

I have tried using .Summary as well as .Content.Content but with no result. Code as an example of what I am trying to achieve:

 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!

Question

Any assistance on experience people have doing this or looking into it before would be appreciated.

Has anyone successfully implemented this feature? Or, is a limitation of the Google API that can't be controlled by the client?


Solution

  • The docs:description element no longer accepts its value as an attribute:

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

    Instead, the value must be passed as the content of the element:

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

    The .NET library has been fixed as of rev. 1196:

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

    Please checkout the latest source and try again.