SharePoint Copy large document library by CSOM

class Program
 {
 static void Main(string[] args)

{

 ClientContext clntContext = new ClientContext("https://<<SiteUrl>>");

FileCollection collFile = clntContext.Web.GetFolderByServerRelativeUrl("https://<<DocumentLibraryUrl>>/").Files;


clntContext.Load(collFile);

clntContext.ExecuteQuery();

 foreach (File file in collFile)
{

 file.CopyTo("<<Destiation document library url>>" + file.Name, true);

Console.WriteLine(file.Name + " is copied successfully");

clntContext.Load(file);

clntContext.ExecuteQuery();

}

 Console.ReadLine();

}

}

}

Comments

Popular posts from this blog

Run Powershell script on Remote Computer/Server

Power BI Refresh Issue: unable to convert the value '' from the source data type 'VT_BSTR' to the expected data type 'VT_I8.

SPDActivities - DP.SharePoint.Workflow - Workflow failed to run