Can't you use v3?
Regards
On Fri, Oct 14, 2011 at 8:00 PM, Harold Garcia <haroldg...@gmail.com> wrote:
> i am having the same problem but resumable upload is not supported for v 2.0
> for .net.
>
--
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Google.GData.Calendar;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.Documents;
using Google.GData.Client.ResumableUpload;
using Google.Documents;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Globalization;
using System.ComponentModel;
using System.Threading;
using System.Collections.Specialized;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Chunk size in MB
int CHUNK_SIZE = 1;
ClientLoginAuthenticator cla = new ClientLoginAuthenticator("yourCompany-yourAppName-v1", ServiceNames.Documents, "Username", "password");
// Set up resumable uploader and notifications
ResumableUploader ru = new ResumableUploader(CHUNK_SIZE);
ru.AsyncOperationCompleted += new AsyncOperationCompletedEventHandler(ru_AsyncOperationCompleted);
ru.AsyncOperationProgress += new AsyncOperationProgressEventHandler(OnProgress);
// Set metadata for our upload.
Document entry = new Document();
entry.Title = "My Document";
entry.MediaSource = new MediaFileSource("c:\\test.pdf", "application/pdf");
// Add the upload uri to document entry.
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());
}
private static void ru_AsyncOperationCompleted(Object sender,
AsyncOperationCompletedEventArgs e)
{
var error = e.Error;
}
private void OnProgress(object sender, AsyncOperationProgressEventArgs e)
{
}
}