zilzar / google-gdata

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

ResumableUploader doesn't parse the newly uploaded entries #571

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
With the ResumableUploader component it is possible to retrieve the uploaded 
entry by attaching an handler to the AsyncOperationCompleted event, however, 
the EventArgs.Entry field is not correctly populated by parsing the response 
stream.

The following code can be used to reproduce the issue:

public void UploadFileAsync(GDataCredentials credentials, FileInfo
fileInformation, string title, string applicationName)
       {
           int CHUNK_SIZE = 1;

           ClientLoginAuthenticator cla = new
ClientLoginAuthenticator(applicationName,"writely",credentials);

           ResumableUploader ru = new ResumableUploader(CHUNK_SIZE);
           ru.AsyncOperationCompleted += new
AsyncOperationCompletedEventHandler(ru_AsyncOperationCompleted);
           ru.AsyncOperationProgress += new
AsyncOperationProgressEventHandler(ru_AsyncOperationProgress);

           Document entry = new Document();
           entry.Title = title;
           entry.MediaSource = new
MediaFileSource(fileInformation.FullName,ContentTypeManager.GetContentTypeByExte
nsion(fileInformation.Extension.ToLower()));

           Uri createUploadUrl = new Uri("https://docs.google.com/
feeds/upload/create-session/default/private/full");
           AtomLink link = new AtomLink(createUploadUrl.AbsoluteUri);
           link.Rel = ResumableUploader.CreateMediaRelation;
           entry.DocumentEntry.Links.Add(link);

           ru.InsertAsync(cla, entry.DocumentEntry, new object());
       }

       void ru_AsyncOperationProgress(object sender,
AsyncOperationProgressEventArgs e)
       {
           // In Progress
       }

       void ru_AsyncOperationCompleted(object sender,
AsyncOperationCompletedEventArgs e)
       {
           //e.Entry is not populated
       }

Original issue reported on code.google.com by ccherub...@google.com on 14 Feb 2012 at 11:59

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Any Updates ???

Original comment by pallavi....@paxcel.net on 17 Feb 2012 at 5:14

GoogleCodeExporter commented 9 years ago
This is addressed in rev. 1162, but it also requires adding a line in the code 
above, after

Document entry = new Document();
// Add the following line
entry.DocumentEntry.Service = new DocumentsService("test");

You should set Service to be an instance of the class that can parse the 
uploaded element. In my sample code I'm uploading a Document so I need a 
DocumentsService instance.

Original comment by ccherub...@google.com on 11 Mar 2012 at 2:09