MightKamioka / google-gdata

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

uploading file problem #662

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I want to upload file in a sub folder of GDocs

i have write my code like this
RequestSettings rqUploadSetting;
        DocumentsRequest docUploadReq;
        rqUploadSetting = new RequestSettings(AppName,GmailCredential);
                docUploadReq = new DocumentsRequest(rqUploadSetting);

 Document doc = new Document();
                doc.Title = "ABC";
                doc.DocumentEntry.IsFolder = true;
                doc = docUploadReq.CreateDocument(doc);
                UploadDirectory(doc, DirectoryPath);
...

void UploadDirectory(Document docDir, string sDirPath)
        {
        string[] sFiles = Directory.GetFiles(sDirPath);
            foreach (string sFile in sFiles)
            {
            Document childFile = new Document();
                    childFile.Title = Path.GetFileName(sFile);
                    childFile.DocumentEntry.IsDocument = true; 
childFile.MediaSource = new MediaFileSource(sFile, sFileType);

                    childFile = docUploadReq.Insert<Document>(new Uri(docDir.AtomEntry.Content.AbsoluteUri), childFile);
//    Error occurs in this line 

}
...

   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.EntrySend(Uri feedUri, AtomBase baseEntry, GDataRequestType type, AsyncSendData data)
   at Google.GData.Client.Service.Insert(Uri feedUri, AtomEntry newEntry, AsyncSendData data)
   at Google.GData.Client.Service.Insert[TEntry](Uri feedUri, TEntry entry)
   at Google.GData.Client.FeedRequest`1.Insert[Y](Uri address, Y entry)
   at GDocSync.GDSync.UploadDirectory(Document docDir, String sDirPath) in D:\CompuOffice\GDockSync\GDockSync\GDSync.cs:line 348

Original issue reported on code.google.com by computax...@gmail.com on 8 Jun 2013 at 7:50