New flavor of a pretty old topic – import into an existing sub site


Since old MOSS 2007 times we evangelized customers to ensure not to apply a site template to the root site of a site collection when using the site collection as the target for a content deployment or stsadm -o import operation as the content coming from the site template can badly interact with the imported content. This can cause the import operation to fail or other type of problems later when using the imported content.

When stsadm was used to export/import subsites into existing site collections we recommended not to create the subsite before the import for the same reasons.

Now with SP2013 where Powershell is the recommended method a small complication comes into play: Import-SPWeb rejects the command if the site to be imported into has not been pre-created.

When creating a new site collection using the UI you have the option to create a site collection with an empty root site by choosing the option "<select template later>" in the "Custom" section of the site templates. Unfortunately this option is not available when creating a subsite using the UI.

As we need an empty sub site as target for the import operation to avoid the issue outlined earlier we have to create the sub site without a template. This can be achieved using the New-SPWeb powershell cmdlet:

The exact sequence of commands to import a sub site using the target Url http://sp/somepath/imported-site would be as follows:

New-SPWeb -Url http://sp/somepath/imported-site
Import-SPWeb -Identity http://sp/somepath/imported-site -path c:\export\exportfile.cab

Comments (2)

  1. OvidiuSt says:

    Thank you Stefan,
    I suppose this is a common error for the SharePoint admins.

Skip to main content