Skip to content

Exporting Document Libraries using Export-SPWeb (syntax headache when exporting from subsite)

09/09/2011

Just spent 30 minutes trying to figure out why I was not able to export a document library using Export-SPWeb.  It’s because the syntax, when you’re dealing with subsites, is a little confusing.  Hoping this will save someone some time.

First of all, despite its name, you can use Export-SPWeb for exporting more than SPWeb objects.  You can export lists and libraries as well which is what I was trying to do.

It’s pretty straight forward when exporting from the top-level site, but with subsites pay attention to the syntax here:
Export-SPWeb -Identity http://PaulsDevSite/sites/MySubsite -ItemUrl /sites/FASTPreview/pages -Path “C:\DevPagesExport.cmp”
Notice, in the ItemUrl parameter I had to give the “/sites” again.  Took me a while to figure out why the operation was bombing out.
Once that’s done just import your doc library in the new location with Import-SPWeb
Import-SPWeb -Identity http://PaulsOtherSite -Path “C:\DevPagesExport.cmp”
Advertisements

From → SharePoint 2010

One Comment
  1. gavinmckay permalink

    Just had the exact same issue. Get-Help wasn’t exactly forthcoming with answers either. All I wanted was a quick export of a Document Library. Your post sorted the problem straight away – thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: