HI Eric,
I changed the URL to "
http://docs.google.com/feeds/default/private/
full" in my custom UploadDocument function.
and now it's giving me an error: {"Execution of request failed:
http://docs.google.com/feeds/default/private/full"}
inner exception: {"The remote server returned an error: (400) Bad
Request."}
here is my custom function:
private static DocumentEntry UploadDocument(DocumentsService service,
Stream stream, string filename)
{
Uri postUri = new Uri("
http://docs.google.com/feeds/
default/private/full");
//convert the extension to caps and strip the "." off the
front
string ext = Path.GetExtension(filename).ToUpper
().Substring(1);
Hashtable GDocumentsAllowedTypes = new Hashtable();
GDocumentsAllowedTypes.Add("CSV", "text/csv");
GDocumentsAllowedTypes.Add("TAB", "text/tab-separated-
values");
GDocumentsAllowedTypes.Add("TSV", "text/tab-separated-
values");
GDocumentsAllowedTypes.Add("TXT", "text/plain");
GDocumentsAllowedTypes.Add("HTML", "text/html");
GDocumentsAllowedTypes.Add("HTM", "text/html");
GDocumentsAllowedTypes.Add("DOC", "application/msword");
GDocumentsAllowedTypes.Add("DOCX", "application/
vnd.openxmlformats-officedocument.wordprocessingml.document");
GDocumentsAllowedTypes.Add("ODS", "application/x-
vnd.oasis.opendocument.spreadsheet");
GDocumentsAllowedTypes.Add("ODT", "application/
vnd.oasis.opendocument.text");
GDocumentsAllowedTypes.Add("RTF", "application/rtf");
GDocumentsAllowedTypes.Add("SXW", "application/
vnd.sun.xml.writer");
GDocumentsAllowedTypes.Add("XLSX", "application/
vnd.openxmlformats-officedocument.spreadsheetml.sheet");
GDocumentsAllowedTypes.Add("XLS", "application/vnd.ms-
excel");
GDocumentsAllowedTypes.Add("PPT", "application/vnd.ms-
powerpoint");
GDocumentsAllowedTypes.Add("PPS", "application/vnd.ms-
powerpoint");
GDocumentsAllowedTypes.Add("PDF", "application/pdf");
string contentType = (String)GDocumentsAllowedTypes[ext];
if (contentType == null)
{
throw new ArgumentException("File extension '" + ext +
"' is not recognized as a valid GDoc extension.");
}
DocumentEntry entry = service.Insert(postUri, stream,
contentType, filename) as DocumentEntry;
stream.Close();
return entry;
}
how do I get this working so I can upload PDF files?
thanks!
Daniel
On Oct 17, 6:22 pm, Eric Bidelman <
api.e...@google.com> wrote:
> 1. No, PDFs need content on creation time.
> 2.
http://docs.google.com/feeds/documents/private/fullis a v2.0
> URI. Change it to /feeds/default/...
>
> -eric
>