Friday, 21 May 2010

Exporting and importing SharePoint sites

A number of our users have SharePoint (WSS 3.0) sites hosted in another office and wanted to move the contents down to our local WSS 3.0 install. This was not as straightforward as you might imagine. We hit a number of gotchas and had to provide workarounds that are documented here so that others can benefit from our experiences.

Running out of disk space on the C: drive

When running an export using stsadm, we kept filling up the C: drive despite exporting to a separate drive. The reason for this is that SharePoint writes temporary files to the location defined by the %TMP% variable. This defaults to the C: drive!

To fix, open a command prompt and type:

set TMP=E:\Tmp

(replace E:\Tmp with the drive and folder you want to use for your temporary storage). Then run the stsadm export and it should work!


Commands to export and import a named site

The command we used to export the site was:

stsadm -o export -url http://old-sharepointserver/hostedsites/development -filename e:\development.cab -includeusersecurity -versions 4 -overwrite

The above command will export the site called "development" referenced at http://old-sharepointserver/hostedsites/development to a file called development.cab. The security information will be included in the export as will all versions of documents.

To import, the following command was used on the new server:

stsadm -o import -url http://new-sharepointserver/development -filename development.cab -includeusersecurity

Note that we are importing the site "development" into the top level and not as a subsite beneath hostedsites. If the name of the site is omitted, the top level site is overwritten!

The gotchas

When running the import, we received the following message:

"The file cannot be imported because its parent web <site path> does not exist"

This error is not helpful and for us the problem was permission related. We had used users (albeit domain admin accounts) to export and import the data that were different from the site collection administrators. To fix we had to do the following:

Make sure the site collection administrator is the same on both the source and destination servers.

When running the export and import, make sure you are running the stsadm commands as the site collection administrator. This ensures the permissions are aligned and the import should work.

stsadm Import error: The 'ASPXPageIndexMode' attribute is not declared

Not sure what the cause of this error is, but we found a fix online:

To get round it I edited C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\DeploymentManifest.xsd on the destination server:

under section

   <!-- SPWeb definition -->

I added the following.


<xs:attribute name="ASPXPageIndexMode" type="xs:string" use="optional"></xs:attribute>
<xs:attribute name="NoCrawl" type="xs:boolean" use="optional"></xs:attribute>
<xs:attribute name="CacheAllSchema" type="xs:boolean" use="optional"> </xs:attribute>
<xs:attribute name="AllowAutomaticASPXPageIndexing" type="xs:boolean" use="optional"></xs:attribute>


With these gotchas overcome, we were able to successfully import the new site.

4 comments:

DoDoBird said...

thank you very much!!

DoDoBird said...

thank you very much!!

Unknown said...

Thanks for your help !!

Also (another gotchas) Destination Site must be on same template as the Exported Site

Else Import error:

“The exported site is based on the template STS#1 but the destination site is based on the template STS#0”.

In my case the source site was created from Blank Site template (STS#1) but the destination site was created from Team site template (STS#0).

Sharepoint Templates - Types are enumerated below :

Template Name
Description
GLOBAL#0
Global template (1033)
STS#0
Team Site (1033)
STS#1
Blank Site (1033)
STS#2
Document Workspace (1033)
MPS#0
Basic Meeting Workspace (1033)
MPS#1
Blank Meeting Workspace (1033)
MPS#2
Decision Meeting Workspace (1033)
MPS#3
Social Meeting Workspace (1033)
MPS#4
Multipage Meeting Workspace (1033)
CENTRALADMIN#0
Central Admin Site (1033)
WIKI#0
Wiki Site (1033)
BLOG#0
Blog (1033)
BDR#0
Document Center (1033)
OFFILE#0
Records Center (1033)
OFFILE#1
Records Center (1033)
OSRV#0
Shared Services Administration Site (1033)
SPS#0
SharePoint Portal Server Site (1033)
SPSPERS#0
SharePoint Portal Server Personal Space (1033)
SPSMSITE#0
Personalization Site (1033)
SPSTOC#0
Contents area Template (1033)
SPSTOPIC#0
Topic area template (1033)
SPSNEWS#0
News Site (1033)
CMSPUBLISHING#0
Publishing Site (1033)
BLANKINTERNET#0
Publishing Site (1033)
BLANKINTERNET#1
Press Releases Site (1033)
BLANKINTERNET#2
Publishing Site with Workflow (1033)
SPSNHOME#0
News Site (1033)
SPSSITES#0
Site Directory (1033)
SPSCOMMU#0
Community area template (1033)
SPSREPORTCENTER#0
Report Center (1033)
SPSPORTAL#0
Collaboration Portal (1033)
SRCHCEN#0
Search Center with Tabs (1033)
PROFILES#0
Profiles (1033)
BLANKINTERNETCONTAINER#0
Publishing Portal (1033)
SPSMSITEHOST#0
My Site Host (1033)
SRCHCENTERLITE#0
Search Center (1033)
SRCHCENTERLITE#1
Search Center (1033)
SPSBWEB#0
SharePoint Portal Server BucketWeb Template (1033)

Unknown said...

Windows PowerShell cmdlet

Export-SPWeb -Identity http://old-sharepointserver/site -Path \\dumpDrive\SPWebExport\export.cmp -IncludeUserSecurity -Force -IncludeVersions 4

Import-SPWeb -Identity http://new-sharepointserver/site -Path \\dumpDrive\SPWebExport\export.cmp -IncludeUserSecurity -Force