I have a huge document library, in which there are thousands of document sets, containing more than 100,000 documents.

My task is to move the document library and its content, to another identical document library, which is on a different Sharepoint site, BUT on the same Office 365.

I tried out-of-the-box Sharepoint methods, but these only let you move one by one (and does not always work). Creating the whole document library as a template worked, but only as a layout. Trying to include the content simply does not work, probably because of the huge amount of documents.

I tried workflows using code: I did not even manage to get to the point of writing any code. Empty Sharepoint project just won't run on my local computer, and when I tried from a server which actually has Sharepoint installed, it still didn't let me connect to an external Sharepoint Online solution. I considered Sharepoint Apps but apparently you can't work with workflows in Apps. I also tried Sharepoint Designer but what I want to do just cannot be done using the Designer.

Then I got to know about CSOM and Powershell. First of all, can I move huge document libraries using either technology? And if yes, which do you suggest?

And how do I get started. This is my first time doing something Sharepoint related that is not simply Document Management using ready-developed Sharepoint features, but requiring actual code.

For CSOM, I did find this, which seems to be helpful, but I want to first literally manage to get started and then take it off from there:

See link

So yep, any help appreciated! :)


Its entirely possible with PowerShell but it will take a long time with so many documents and so you will need to be clever about checking and error handling to ensure you don't have to restart the task plus you need to consider all properties, version history permissions etc.

Take a look at the Office365 Powershell PnP commandlets which will help you get document sets and documents without knowing too much CSOM, this way you can loop through and move / copy them to a second library easily.


Alternatively if you have budget take a look at the ShareGate migration tool which will save you hours of time.


  • Thanks about this. What about CSOM? Do you consider PowerShell a better option here? Im simply asking because I know C# better. Aug 12 '16 at 8:20
  • When you say 'consider all properties' you mean that this powershell method will normally copy-paste all the properties and you only need to check the odd one that failed?
    – susan
    Aug 12 '16 at 9:02
  • PowerShell for SharePoint online uses the C# libraries so there isn't much difference in the application, the PnP-PowerShell project just gives you cmdlets to work with to save time.
    – Col.Cook
    Aug 15 '16 at 6:55
  • I say consider all properties as you will need to handle the movement of the document itself and then ensure all relevant metadata/fields are updated with the correct information, also if required you will need to ensure you bring all the relevant version history with it. For a few hundred documents I would just use PowerShell for quickness but as you are talking 100k+ I would consider either creating an application which can stop / start / pick up where it fails, or just use the Share-gate Tool which is purpose built for the job.
    – Col.Cook
    Aug 15 '16 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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