veron-li / google-gdata

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

DocumentsService.Upload file not able to upload PDF,Docx using GData dot net library. #549

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Create a DocumentsServiceObject
2.Call Uploadfile with convert = False.
3.Exception happens

following is the code
 FileInfo info = new FileInfo(<filePaths>);
                string str = info.Extension.ToUpper().Substring(1);
                string contentType = (string)DocumentsService.DocumentTypes[str];
                DocumentsService myService = new DocumentsService("TestGdoc");
                myService.setUserCredentials(<username>, <password>);
                myService.UploadFile(filePaths[0], "test", contentType, false);

The exception details.
innerexception -{"The remote server returned an error: (403) Forbidden."}
Message -Execution of request failed: 
https://docs.google.com/feeds/default/private/full?convert=false
ResponseString -<errors 
xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>Serv
iceForbiddenException</code><internalReason>Files must be uploaded using the 
resumable upload mechanism.</internalReason></error></errors>

Windows xp 32 bit OS.

For PDF even with convert =true it is failing.

Original issue reported on code.google.com by TestUser...@gmail.com on 18 Oct 2011 at 8:09

GoogleCodeExporter commented 8 years ago
Stack Trace:
   at Google.GData.Client.GDataRequest.Execute()
   at Google.GData.Client.GDataGAuthRequest.Execute(Int32 retryCounter)
   at Google.GData.Client.GDataGAuthRequest.Execute()
   at Google.GData.Client.Service.StreamSend(Uri targetUri, Stream inputStream, GDataRequestType type, String contentType, String slugHeader, String etag, AsyncSendData data)
   at Google.GData.Client.Service.StreamSend(Uri targetUri, Stream inputStream, GDataRequestType type, String contentType, String slugHeader)
   at Google.GData.Client.Service.Insert(Uri uriTarget, Stream input, String contentType, String slugHeader)
   at Google.GData.Documents.DocumentsService.UploadFile(String fileName, String documentName, String contentType, Boolean convert)
   at GDocs.Pages.Helper.GDocsHelper.LoadDocument(String path, String fileName) in D:\sayon\test Docs\test Docs\GDocsHelper.cs:line 282

Original comment by TestUser...@gmail.com on 18 Oct 2011 at 8:11

GoogleCodeExporter commented 8 years ago
Issue 548 has been merged into this issue.

Original comment by ccherub...@google.com on 18 Oct 2011 at 4:49

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
As reported by the error message, you have to use the resumable upload 
mechanism to upload any kind of files.
Please also check

http://googleappsdeveloper.blogspot.com/2011/05/upload-all-file-types-to-any-goo
gle.html
http://code.google.com/p/googlecl/issues/detail?id=394

Original comment by ccherub...@google.com on 18 Oct 2011 at 5:39