STSADM Import / Export

STSADM has two operations called “”import”” and “”export””.

Export allows you to backup a copy of a site to the file system. This will generate one or more .CMP files (based on the size of the site, this will distribute the contents over many .CMP files).

Import allows you to take the files generated by an export and import over a blank SharePoint Site.

Please note: Both Import and Export operations for STSADM deal with an entire site. You cannot export or import individual items such as lists or items.

I used Import / Export during a migration to restructure the sites. Basically I had a collection of WSS sites for active projects and a collection of WSS sites for archive projects which weren’t logically organised. I wanted to introduce a level for the active projects and another level for the archive projects. I created these levels (active and archive) in SharePoint through the standard create site function. I then need to move the archived sites under archive and active under the active site. This process is often referred to a re-parenting. I did this using STSADM and the Export operation and the Import operation (see below).

STSADM -o export -urlhttp://localhost/ProjectSite1 -filename c:\export\ProjectSite1 -includeusersecurity
STSADM -o createweb -url http://localhost/Archive/ProjectSite1
STSADM -o import -urlhttp://localhost/Archive/ProjectSite1 -filename c:\export\ProjectSite1.cmp -includeusersecurity

Please note: By using the parameter “”includeusersecurity”” it preserves the current user, rights for the site. This is an optional parameter, but very useful.

The createweb operation creates a blank site for the import to write the contents of the export over. You shouldn’t specify a sitetemplate as you just need a blank container (the template is defined in the export .CMP files).

STSADM is a command line tool, so you could wrap these commands in a batch file.

Advertisements

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