SharePoint 2010 - Copy documents across libraries while keeping Versioning

I've recently been looking into a good Document Management solution using OOTB SharePoint 2010 functionality.  I'll explain my solution that should cover ISO in another post, but here I'd like to explain another issue I had with moving files from one Document Library to another while keeping all the version history.

The only way I've found to keep all the version history is to make both libraries identical, then to open both libraries with File Explorer & move the files to the second Library.  Alternatively, you can use the 'Manage Content & Structure' area to move them as well.

If you are like me, you have some trust issues with Microsoft at times, and don't want to risk moving the files and all their information if it doesn't work!

So here's the easiest (oh god) way I found to do it safely.
  • Export (Backup) a copy of the Document Library containing all the data you wish to transfer:
Export-SPWeb -Identity "http://[servername]/[site]/" -Path "\\[servername]\Backup\[FileName].cmp" -ItemUrl "[DocLibrary Address]/" -includeversions All -IncludeUserSecurity -verbose

I'm using -includeversions all to keep every version of every document in the library.  and i'm using -IncludeUserSecurity to preserve the user detail like created by, modified by, etc..

  • Restore a copy of the Document Library to a temporary site (Create the site first, I've had troubles with the moving unless both sites are directly beneath the root site.  So if you can, don't build the temp site beneath the site you will be copying to):
Import-SPWeb -Identity "http://[servername]/temp" -Path "\\[servername]\Backup\[FileName].cmp" -IncludeUserSecurity -force

  • Open up both libraries via File Explorer (Temp Library and Library where you wish to move the docs to), Drag & Drop all files (Move!).  
  • Check to ensure success

Like I said, easiest way to move files with their version history in the safest manner without risking losing data from your live source.

You are welcome.


Popular posts from this blog

Export Group Membership From Active Directory Using Power Query

HP Laserjet 1022 Printer - Can't Print on Windows 10

Power Query / BI - Data Refresh Error: The column 'Activities' of the table wasn't found