sdrose65 / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

I want to update entries and get a 400 Error #523

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Here my sourcecode:

DocumentsService docService = new DocumentsService("mosUniverse-testApp-1");
DocumentsFeed feed;

...

docService.setUserCredentials("email@gmx.de", "Password");
feed = docService.Query(new DocumentsListQuery());

...

AtomEntry entry = new AtomEntry();
AtomPerson author = new AtomPerson(AtomPersonType.Author);
author.Name = "Moritz";
author.Email = "mail@gmx.de";
entry.Authors.Add(author);
entry.Title.Text = "Tennis with Beth";
entry.Content.Content = "Meet for a quick lesson.";

docService.Insert(feed, entry); // Here i get a 400 error.

...

feed.Entries[listBox1.SelectedIndex].Content.Content = textBox1.Text;
feed.Entries[listBox1.SelectedIndex].Update();  // here the same error

The error is:
Execution of request failed: https://docs.google.com/feeds/default/private/full

Could someone help me?
It would be great!

Original issue reported on code.google.com by moritz.g...@gmail.com on 10 Jul 2011 at 11:25

GoogleCodeExporter commented 9 years ago
If you check the complete error message, it reads "Entry must contain at least 
one category".
There are many ways to specify the category, you may probably want to add a 
line like the following before you call Insert:

entry.Categories.Add(DocumentEntry.DOCUMENT_CATEGORY);

Original comment by ccherub...@google.com on 13 Jul 2011 at 12:04

GoogleCodeExporter commented 9 years ago
Thank you very mutch. The upload works now with:

AtomEntry entry = new AtomEntry();
AtomPerson author = new AtomPerson(AtomPersonType.Author);
author.Name = "Moritz";
author.Email = "moritz.goeckel@gmx.de";
entry.Authors.Add(author);
entry.Title.Text = "Tennis with Beth";
entry.Content.Content = "Meet for a quick lesson.";
entry.Categories.Add(DocumentEntry.DOCUMENT_CATEGORY);
docService.Insert(feed, entry);

But the content does not apear online an googleDocs.
What is wrong?
Does anyone know?

By the update apears this error. I dont understnand. Is it wrong to put 
text in the Content?
"[Line 29, Column 15, element content] This element must not have any 
text() data"

<errors 
xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>Pars
eException</code><internalReason>[Line 
29, Column 15, element content] This element must not have any text() 
data</internalReason></error><error><domain>GData</domain><code>textNotAllowed</
code><internalReason>This 
element must not have any text() data</internalReason></error></errors>

Original comment by moritz.g...@gmail.com on 15 Jul 2011 at 6:49

GoogleCodeExporter commented 9 years ago
You can't access the content of the documents using the API.
What you can do is creating a text file and uploading it using 
docService.UploadDocument().

Original comment by ccherub...@google.com on 15 Jul 2011 at 9:49

GoogleCodeExporter commented 9 years ago
Ah okay...
Thank you very mutch!

Original comment by moritz.g...@gmail.com on 15 Jul 2011 at 11:40