Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

I cannot upload files to a site within a sub site collection. "http:\\WS.CHI.COM/sites/MigrationTesting/GDriveMigration"

$
0
0

If I create a "Shared Documents" library in http:\\WS.CHI.COM I can upload a file just fine with the code below, but when I add the site collection "MigrationTesting" and the sub site "GDriveMigration" I get a WebException was unhandled error. The remote server returned an error (409) Conflict

static void Main(string[] args)
        {
            String fileToUpload = @"C:\SPupload.txt";
            // WORKS 
                //ClientContext context = new ClientContext("http://reporting10.chi.com"); 
            //WORKS 
                //ClientContext context = new ClientContext("http://ws.chi.com"); 
            //NOT WORKING
            ClientContext context = new ClientContext("http://ws.chi.com/sites/MigrationTesting/GDriveMigration"); 
            Web currentWeb = context.Web;
            context.Load(currentWeb);
            context.ExecuteQuery();
        using (FileStream fs = new FileStream(fileToUpload, FileMode.Open))
        {
            Microsoft.SharePoint.Client.File.SaveBinaryDirect(context, "/Shared Documents/SPUpload.txt" , fs, true);
        }
        }


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>