2

I would like to know how to export a document library (SharePoint 2010) using PowerShell and also saving metadata about content. I need to repopulate the document library with items coming from itself. In other words, I want to separate list items of the list structure.

The procedure should follows the steps below:

  1. Export content of the document library (documents and associated metadata)
  2. Delete the document library
  3. Recreate the same document library (empty)
  4. Populate the document library with exported data
2

Export:

Export-SPWeb -Identity http://sharepointsite/sitecollection/ -itemurl “/site collection/library2” -path "c:\sharepoint\library2.cmp" -IncludeVersions All

Import:

Import-SPWeb -Identity  http://sharepointsite/sitecollection/  -Path "c:\sharepoint\library2.cmp" -Force

here path is the file where you want to save the exported list could be any location or simply give a path to your desktop. there are other attributes also take a look here https://technet.microsoft.com/en-us/library/ee428293%28v=office.14%29.aspx

  • Thank you for your answer, it's working. However, this is not what I'm looking for. I've edited the question, please take a look. I would like to be able to modify some metadata before inserting items inside the list. – ameliapond Dec 28 '15 at 12:38
1

Use the below links for the Export-SPWeb and Import-SPWeb commands.

If you need permissions and versions then use additional commands with parameters like IncludeSecurity and IncludeVersions.

Note: If you are doing this activity on a subsite then you need to specify the ItemUrl property as well.

Example if you need export from subsite xyz with library pilo:

Export-SPWeb -Identity "http://sitename/xyz" -Path "D:\Folder\export.cmp" -ItemUrl "xyz/lists/pilo" -IncludeSecurity -IncludeVersion All

Import-SPWeb -Identity "http://newsite/wer" -Path "D:\Folder\export.cmp"
  • This is the first link I visited but it is not clear. What is -Path <Path and file name> ? What file are we talking about exactly ? Could you please provide an example ? – ameliapond Dec 23 '15 at 15:41
  • The link clearly states : Before you begin, you must create a folder on the local computer or the network in which to store the export file. So the path is ur file system folder where you need the export – Nikhil J Dec 23 '15 at 16:33
  • You're right, but I did not read the part for exporting using central administration because I don't want to use this method. So I wasn't aware of the cmp stuf. – ameliapond Dec 23 '15 at 17: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.