How do I retain metadata on a sharepoint 2010 Document Library when moving from one site to another?

Posted on 2013-10-08
Medium Priority
Last Modified: 2013-11-10
We have a document library within our main SharePoint 2010 site.  This document library has custom columns added where the users can add descriptions to the files they upload.

Recently we've had the need arise where we had to make these files available to external users.  So in order to do that and keep the rest of our SharePoint data secure, we created a separate SharePoint site and made it available to the outside.

The problem I'm having now is I need to be able to move this document library over to the new site and retain all of the metadata that was added in those custom columns.

I've been told be a local consulting company that the only way to do this is to pay for tool that charges by the gb (we currently have over 25gb of files in the document library).

Does anyone now of an easy way to do this or can we even script this migration with .NET?

Question by:maximjon
  • 2
LVL 15

Accepted Solution

colly92002 earned 2000 total points
ID: 39557306
Easiest way (provided you want to copy the whole list) is simply to do a backup and restore.

you can backup a list in powershell:
Export-SPWeb -Identity http://<your site url> -Path C://listBackup.cmp -ItemUrl <relative path to list>

Open in new window

Restore to other site:
Import-SPWeb -identity http://<your other site url> -Path C://listBackup.cmp -UpdateVersions Overwrite

Open in new window

If you do this you will want to clear down the target list every time you refresh it, which can be done like this:

#Add-PSSnapin Microsoft.SharePoint.PowerShell

# Replace siteurl with actual web url
$web = Get-SPWeb -Identity "http://<your other site>"
# Replace docurl with document library url
$list = $web.GetList("<relative path to list>")

function DeleteFiles {
    $folder = $web.GetFolder($folderUrl)
    foreach ($file in $folder.Files) {
        # Delete file by deleting parent SPListItem
        Write-Host("DELETED FILE: " + $file.name)

# Delete root files

Open in new window


Author Closing Comment

ID: 39634479
This was perfect!  Thank you so much!  I was originally told by consultants that the only way to do this was to buy a 3rd party product.  You literally saved my company thousands of dollars.  Thank you!
LVL 15

Expert Comment

ID: 39637423
No problem, happy to help :)

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
Watch the video of Kernel Migrator for SharePoint, which demonstrate the process easily of migration from SharePoint to SharePoint, OneDrive for Business & Google Drive servers, Public Folder to SharePoint, File Server to SharePoint. The tool has va…
Did you know PowerShell can save you time with SaaS platforms? Simply leverage RESTfulAPIs to build your own PowerShell modules. These will kill repetitive tickets and tabs, using the command Invoke-RestMethod. Tune into this webinar to learn how…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question