SharePoint: Move a Subsite to Another Site Collection

Disclaimer: This method works well, but I have not researched all of the details of an export — primarily what’s exported, what’s not and what are the consequences of using – versions. These are mostly my notes, quick and dirty style.

A task as basic as moving a whole site from one site collection to another should be pretty straightforward, but that doesn’t appear to be the case. There may be a few ways to do it, but I’m always partial to STSADM and will be using it for this solution.

First thing is first: stsadm -o backup is not the appropriate command to export a subsite. Backup/restore deals with entire site collections. Export/import deal with sites on a more granular level. If you restore a backup, you will wipe out your entire site collection.

So initially, we exported a site and restored it successfully. First, we created a subsite on the “new” server using the department template. Then we exported and imported.

stsadm -o export -url http://sitecollectionA/indiesite/ -filename c:\subsite.bak
stsadm -o import -url http://sitecollectionB/indiesite/ -filename c:\subsite.bak

However, in loading up the site, we were presented with a FILE NOT FOUND error and much of the admin site was broken. Using specific URLs, we could see that the data was there, but it was virtually inaccessible. In looking around, versioning was suggested to be the issue and the following commands were suggested:

stsadm -o export -url http://sitecollectionA/indiesite/ -filename c:\subsite.bak -includeusersecurity -versions 4
stsadm -o import -url http://sitecollectionB/indiesite/ -filename c:\subsite.bak -includeusersecurity -UpdateVersions 2

We deleted the subsite and it’s subsites — because a subsite cannot be deleted if it has its own subsites, using the web interface was going to be tedious, so we just ran the following from the command line.

stsadm -o deleteweb  -url http://sitecollectionB/indiesite/subsiteA/supersub
stsadm -o deleteweb  -url http://sitecollectionB/indiesite/subsiteA
stsadm -o deleteweb  -url http://sitecollectionB/indiesite/subsiteB
stsadm -o deleteweb  -url http://sitecollectionB/indiesite/

After the subsite was deleted and recreated using the department template, we ran the export/import with the version info. Unfortunately, we were still faced with the FILE NOT FOUND issue. I’d encountered that error in the past and remembered it to be something simple to fix. Sure enough, we just needed to reapply the master page to the site.

http://sitecollectionB/indiesite/_layouts/settings.aspx -> Look and Feel -> Master Page -> Reset all Subsites to Inherit This System Master Page Setting.

This seemed to do the trick and we proceeded to move several sites in a similar manner.

Chrissy is a PowerShell MVP who has worked in IT for nearly 20 years, and currently serves as a Sr. Database Engineer in Belgium. Always an avid scripter, she attended the Monad session at Microsoft’s Professional Developers Conference in Los Angeles back in 2005 and has worked and played with PowerShell ever since. Chrissy is currently pursuing an MS in Systems Engineering at Regis University and helps maintain RealCajunRecipes.com in her spare time. She holds a number of certifications, including those relating to SQL Server, SuSE Linux, SharePoint and network security. She recently became co-lead of the SQL PASS PowerShell Virtual Chapter. You can follow her on Twitter at @cl.

Posted in SharePoint
One comment on “SharePoint: Move a Subsite to Another Site Collection
  1. Raman says:

    Hi Chrissy,

    I followed the above instruction but using shell script command . I am moving a subsite (http://TopSite/abc) contents to different site collection

    (http://TopSite/sites/xyz). I am using shell scripts to export from subsite to a file and from that

    file I am trying to import to sitecollection but it throws an exception " Could not find WebTemplate

    #11003 with LCID 1033".

    Any help will be great appreciated.

    Thanks,
    Raman

Leave a Reply

Your email address will not be published. Required fields are marked *

*