Subscribe:      
 

Exporting and Importing SharePoint 2010 Content

Written By: Arshad Ali -- 11/11/2010 -- join -- contribute -- (5) comments -- printer friendly version

Rating: Rate --

Categories: Infrastructure, SharePoint 2010, System Administration

< Prev - 1 | 2 | 3 | - Next > | Become a paid author

Exporting and Importing a Site, Library, orList using PowerShell cmdlets

The SharePoint 2010 Central Administration UI is not the only way to export a site, library, or list. SharePoint 2010 provides PowerShell cmdlets to export or even to import them back whenever required. You can even script out these operations to run  manually or schedule them with the Windows Task Scheduler to make it run on a  scheduled basis.

Let's explore these cmdlets in detail.

The Export-SPWeb command is used to export a site, library, or list.

The Import-SPWeb command is used to import them back.

The general syntax of these commands are:

Export-SPWeb [-Identity]

<url of the site to be exported> -Path <location and name of the file to be created after export> [-Force] [-IncludeUserSecurity] [-IncludeVersions <LastMajor | CurrentVersion | LastMajorAndMinor | All>] [-ItemUrl <Any specific item to export, like document library or list>]

Import-SPWeb [-Identity]
<url of the site to be exported> -Path <location and name of the file to be imported from> [-Confirm] [-Force] [-IncludeUserSecurity] [-UpdateVersions <Append | Overwrite | Ignore>]

You can use the IncludeUserSecurity parameter to export the associated security with the site, library, or list which includes users in the site, authors of documents and lists, when the document or list was created and modified, etc... and the IncludeVersions parameter to specify which versions of the documents or list items you want to export, whether to export current versions, last major versions, last major or minor versions or all versions, etc.

To launch SharePoint 2010 PowerShell console, go to START -> All Programs -> Microsoft SharePoint 2010 Products -> SharePoint 2010 Management Shell and click on it. To export a site, library or list we need to use Export-SPWeb command and specify the location where the exported file will be stored, the URL of the site, library or list. The Force parameter is used to overwrite a file with the same name, if it exists, during export and overwrite a site, library or list with the same name, if it exists, during an import operation.

The first command, given below, will export contents of all the sites of the specified site collection.

The second command will export contents of the specified site only.

The third command will export the content of the Shared Documents library of the specified site (specified with ItemURL parameter).

Export-SPWeb -Identity http://mktaraliw2k8r2:8081 -Path \\MKTARALIW2K8R2\SharePointBackupFolder\PSAllSites.cmp -Force
Export-SPWeb -Identity http://mktaraliw2k8r2:8081/hr -Path \\MKTARALIW2K8R2\SharePointBackupFolder\PSHRSite.cmp -Force
Export-SPWeb -Identity http://mktaraliw2k8r2:8081/hr -Path \\MKTARALIW2K8R2\SharePointBackupFolder\PSSharedDocuments.cmp -ItemURL "Shared Documents" -Force

The first command, below, will import all the sites available in the exported file to the specified site collection.

The second command will import the contents to the specified site only, in this case the site must exist and the contents will be overwritten.

The third command will import the content of the Shared Documents library of the specified site, in this case the content will be overwritten.

Import-SPWeb -Identity http://mktaraliw2k8r2:8081 -Path \\MKTARALIW2K8R2\SharePointBackupFolder\PSAllSites.cmp -Force
Import-SPWeb -Identity http://mktaraliw2k8r2:8081/hr -Path \\MKTARALIW2K8R2\SharePointBackupFolder\PSHRSite.cmp -Force
IImport-SPWeb -Identity http://mktaraliw2k8r2:8081/hr -Path \\MKTARALIW2K8R2\SharePointBackupFolder\PSSharedDocuments.cmp -Force

 

< Prev - 1 | 2 | 3 | - Next >



Learn more about SharePoint



Sponsor Information




Copyright (c) 2010-2017 Edgewood Solutions, LLC All rights reserved
privacy | disclaimer | copyright | advertise | contribute | feedback | about
Some names and products listed are the registered trademarks of their respective owners.


MSSharePointTips.com | MSSQLTips.com