Tag Archives: Import-SPWeb

How to export / and import SharePoint 2013 sites, lists, or libraries with PowerShell

For copying individual items across your SharePoint 2013 environments or making single item backups of  sites, lists, or libraries you may employ following PowerShell commandlets: Export-SPWeb and Import-SPWeb.

Here is a basic example of performing library export and further import using those cmdlets. First, export:

Export-SPWeb -Identity http://sitename.domainname.com -ItemUrl /Library_Name -path "c:\Library_Name_Backup.cmp"

The only thing which may cause some difficulties is how to correctly specify Identity and URL parameters, as if you are going to look at the URL of SharePoint library when it is opened in browser and try to use it – it won’t work out. Usually URL of a library accessed in browser looks similar to this:


You have to take parts highlighted in bold for Export-SPWeb as a values for Identity and ItemUrl parameters including slash symbol in front of library name, otherwise it won’t work. E.g. if you omit slash in the beginning of URL parameter value Export-SPWeb will throw following (not quite self explanatory) error at you:

Export-SPWeb : <nativehr>0x80070057</nativehr><nativestack></nativestack> At line:1 char:1

So type things carefully 🙂

Next is import:

Import-SPWeb http://yoursite.yourdomain.com -Path c:\Library_Name_Backup.cmp -UpdateVersions Overwrite

Use of this 2 cmdlets will help you to create item level backups for sites, lists and libraries in SharePoint 2013. By the way for those who wondering what CMP file extension stands for – this is abbreviation for “Content Migration Package”.

And if you want to run these commands from regular PS session without starting SharePoint Management Shell be sure to load SP PS snapin using script below: