I have a set of 200 excel files which I need to update on our SP server.

They originate on a network drive - I will use C# to move these files into their destination document library.

The files are around 400KB in size and moving such files around our network drives is instantaneous.

Here is the code I'm using for a single file move:

using System;
using System.IO;

namespace MoveFilesToSharepoint
  class Program
    static void Main(string[] args)

      string sourceDirX = @"\\networkfileserve\aDirectory\aFolder\example.xlsx";
      string destDirX = @"\\SPserver\subsiteName\docLibName\example.xlsx";

      File.Copy(sourceDirX,destDirX,overwrite: true);

      Console.WriteLine("press [enter] to exit");

On my machine this takes 15 seconds - on my colleagues higher spec machine 10 seconds - this time is obviously practically unacceptable.

Are there settings within sharepoint that I need to change - maybe in respect of the document library to speed up this upload?

1 Answer 1


Does this require C# code? Can this be a drag-and-drop solution? What about opening the SharePoint Library in explorer mode and just dragging the files over?

But if you need to pragmatically do it, I would give the File.SaveBinaryDirect method with CSOM a go to help increase speed.

using (var clientContext = new ClientContext(url))
     using (var fs = new FileStream(fileName, FileMode.Open))
         var fi = new FileInfo(fileName);
         var list = clientContext.Web.Lists.GetByTitle(listTitle);
         var fileUrl = String.Format("{0}/{1}", list.RootFolder.ServerRelativeUrl, fi.Name);

         Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext, fileUrl, fs, true);

Here is a quick overview and some great resources as well: https://stackoverflow.com/questions/17057074/how-to-download-upload-files-from-to-sharepoint-2013-using-csom

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.