Thursday, March 31, 2011

Move SharePoint Site Collection as a Subsite

Environment: SharePoint 2007/2010/2013

Requirement: To move a site collection as a subsite to another site collection, we can make use of STSADM or Powershell import/export command.

Following are the steps to achieve this

Assume that, we need to move the site collection http://sitecollection1/sites/asite to another site collection http://sitecollection2/sites/bsite as a subsite.


Steps

1. Export the site collection (http://sitecollection1/sites/asite) using STSADM command line tool

using stsadm command
stsadm.exe -o export -url http://sitecollection1/sites/asite -filename c:\backups\sc_asite.bak –includeusersecurity –nofilecompression

using powershell
Export-SPWeb -Identity http://sitecollection1/sites/asite -Path C:\backups\sc_asite.bak -IncludeUserSecurity -NoFileCompression

2. Create a new site with Blank Site template in the other site collection (http://sitecollection2/sites/bsite). Assume the blank site name is csite

3. Import the backed up site collection in c:\mybckup\sc_asite.bak

using stsadm command
stsadm.exe -o import -url http://sitecollection2/sites/bsite/csite -filename c:\backups\sc_asite.bak 
-includeusersecurity -nofilecompression

using powershell
Import-SPWeb http://sitecollection2/sites/bsite/csite  -Path c:\backups\sc_asite.bak -IncludeUserSecurity -NoFileCompression


After migration, the site collection 1 will be available under the following URL as a subsite http://sitecollection2/sites/bsite/csite



10 comments:

  1. Hi Thanks for this really pointed me in the right direction,i added a few other operations on the command. Just a quick note that the export line on our server was being strict and i had to add the .exe after stsadm. Id hate for people to take away from this useful post just cos they didnt exercise a bit of common sense on the export routine!! Thanks :-)

    ReplyDelete
  2. Move SharePoint Site Collection as a Subsite how do I do his in sharepoint 2013

    ReplyDelete
  3. It does not seem to work with 2013

    ReplyDelete
  4. @Rendani, I haven't tested this in SP2013, did you try to use similar powershell commands to the stsadm commands?

    ReplyDelete
  5. Updated powershell command for SharePoint 2013

    ReplyDelete
  6. getting error that List does not exist. for sharepoint 2013

    ReplyDelete
  7. I used the stsadm command to move a site collection to a sub site of another site collection. The migration worked great but afterwards I could no longer create subsites or apps. Is there a fix for this that you know of?

    ReplyDelete