Click here to Skip to main content
Click here to Skip to main content

Moving a Sharepoint Sub Site to its own Site Collection in 3 easy steps

By , 29 Mar 2012
 

Moving a Sharepoint Sub Site to its own Site Collection why should I do that?  Well, there might be a lot of reasons on doing this but for me its more handing over the Site collection Administration to the business which enables business owners to choose themes, manage security within the site collection, manage activated solutions and deploy other customizations.  Another good reason for me is about Quota Management which I can’t do in a Sub Site model.  How about you what's you reason?

So whatever your reason is I guess you either want to do it or thought of doing it that is why you are reading this article.  So let’s get started and perform that 3 easy steps in moving your Sub Site in its own Site Collection.

On this demo we will be moving a Sub Site called “Sandbox” which is located in http://someURL/SomeTeamSite/sandbox


Step 1: Export your subsite by using the Export-SPWeb command.

You can do this on your Sharepoint Server and run the command using the SharePoint 2010 Management Shell.  For this sample I had used the following command

Export-SPWeb -Identity "http://someURL/SomeTeamSite/sandbox/" -Path "C:\Exported Sub Site\SandboxSubsSite.cmp" -IncludeUserSecurity -IncludeVersions all

What that command does is basically export the sub site to a .cmp file where we included all Security Settings and Versions for more options check out Export-SPWeb on TechNet

You will notice once it exports you will have a log file showing you whats been done during the export process.

Step 2: Create you site collection.  This is where you will host your new site.  

Still on the Sharepoint Server (you can also do this remotely), go to “SharePoint 2010 Central Administration” then into “Application Management” then “Site Collections” then “Create a Site Collection”.

Indicate all of the properties needed

Take note you can also create managed paths, which means you can create a site at a specific path. To do that click on “Define Manage Paths” under the “Web Site Address”.

Once everything is set up properly you will receive a confirmation that your site collection was created.

Step 3: Import your Content Migration Package (CMP) file that you exported using Import-SPWeb.

Still in the Sharepoint Server using the SharePoint 2010 Management Shell issue the Import-SPWeb command, for this sample it would be something like this

Import-SPWeb "http://someURL/sites/Sandbox" –Path "C:\Exported Sub Site\SandboxSubsSite.cmp"

Like Export-SPWeb the Import-SPWeb can have several parameters which you can see on TechNet

It will also create an Import log and once the import finishes your all good to go.

Now check your new site collection and compare to the sub site, and if your happy feel free to remove the subsite.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Raymund Macaalay
Technical Lead
New Zealand New Zealand
Member
http://nz.linkedin.com/in/macaalay
http://anyrest.wordpress.com/

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionThis's a good solution.memberMember 294094918 Apr '13 - 11:19 
Thanks especially for moving a sub site which couldn't be done with backup-restore pair. This PowerShell way worked out great for me!
QuestionTried and FailedmemberSP Joe22 May '12 - 10:02 
I have previously tried this solution which I pieced together on my own and had some issues, but when I found this solution mirroring what I had previously tried I thought I'd give it a shot again. The problem I have is that during the Import phase of the process I get an error stating
 
"Import-SPWeb : The file cannot be imported because its parent /sites/subsite/subsite does not exist."
 
The export was done against http://SomeURL.org/SubSite and the Site Collection created was named http://SomeURL.org/sites/SubSite.
 
What I am trying to accomplish over all is to move a subsite within a web application to another web application which is a host header site collection, giving this subsite its own site collection that does not have a managed path. So in order to accomplish this the first step is to promote this subsite to its own Site Collection within the current web application.
 
Any suggestions are appreciated!
QuestionNice JobmemberRobert P. Howard3 Apr '12 - 13:06 
Hi Raymund,
Nice work on this article!
 
In step two you return to using the GUI; is there any reason that you chose not to continue within Powershell?
 
One things that I and others have noticed with Import-SPWeb and Export-SPWeb is that the association between Lists and Workflows is not correctly migrated.
 
Other than that keep up the good work. Smile | :)
Rob
AnswerRe: Nice JobmemberRaymund Macaalay3 Apr '12 - 13:44 
On step 2 I am more confident on using the UI but that does not stop someone in using Powershell scripts.
 
And on your second statement is that a question or is that what happened to your trial? On my experience everything was imported even associations between the list inside the sub site
GeneralRe: Nice JobmemberRobert P. Howard3 Apr '12 - 15:07 
The issue with the Workflows is something I have encountered in my personal experience as well as finding others that have also "suffered" from this issue.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 29 Mar 2012
Article Copyright 2012 by Raymund Macaalay
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid