Convert Subsite to Site Collection and Site Collection to Subsite in SharePoint
During the migration of MOSS 2007 to SharePoint 2010, wanted to convert some of the large subsites into site collection in a separate content databases. How to convert a subsite to a site collection in SharePoint? sure, Its possible to promote subsite to site collection in SharePoint.
Follow these Steps to Convert Subsite to Site collection:
- Export the Source sub-site
- Create a new Site collection in a Separate content database
- Import the backup into the site collection.
1. Export the subsite
Export the source sub-site using STSADM command line:
stsadm -o export -url <URL-of-the-Sub-site> -filename <Backup-File-Name> -includeusersecurity -versions 4
2. Create a New Site collection in its own Database, without assigning template
Execute this command line to create a new site collection in new content database.
stsadm -o createsiteinnewdb -url <Site collection URL> -owneremail <e-mail of the site owner> -ownerlogin <domain\username> -title <Title-for-site-collection> -databaseserver <DB-Server-Name> -databasename <Database-name>
3. Import the SubSite Export(Backup) into the Site collection
Now, we need to import the sub-site into the newly created site collection. Use the STSADM command line:
stsadm -o import -url <Target-Site-collection-URL> -filename <backup-File-Name> -includeusersecurity
How to convert a site collection to subsite?
Want the reverse? Move a site collection to a subsite in SharePoint 2007? Simple: Export the site collection using stsadm -o export, creates a blank sub-site, and then import the exported site collection into sub-site using stsadm-o import. Just Export the Site collections and import them as Sub-site:
stsadm -o export -url https://sharepoint.com/sites/site-collection -filename c:\sitecollection.bak -includeusersecurity -nofilecompression
stsadm -o import url https://sharepoint.com/sites/site-collection/subsite -filename c:\sitecollection.bak -includeusersecurity -nofilecompression
Or you can use Third party products like: DocAve or ControlPoint to migrate SharePoint subsite to site collection.
Browse to the Site collection, verify Page Layouts, master pages, content types, navigation, web parts and etc. Once tested, delete the sub-site using: stsadm -o deleteweb -url <sub-site-url>
Please note, In Export-Import you’ll loose few things, such as:
- Workflow Associations, History, Tasks
- Feature/Solutions activated
- Recycle bin
If you get “File not found” or “Page not found” don’t panic. Look into welcome page/Master page settings. If you are moving from one environment to another, make sure you have identical features/solutions deployed in both environments.
In the case of Publishing sites, It may lead to page layout issues (site collection pages will be pointing to old sub-site’s page layouts). Use Gary’s STSADM extensions to resolve: https://github.com/glapointe/PowerShell-SPCmdlets
One thought on “Convert Subsite to Site Collection and Site Collection to Subsite in SharePoint”