Thursday, May 1, 2008

SharePoint Subsite Move Up 1 Level

by Zac Smith, 9 July 2007
Had a situation recently where I needed to promote a subsite to a top level site. As STSADM backup/restore can only be used at the site collection level, a different approach was required.
As of WSS v3, there are two new STSADM commands - import and export.
The basic procedure to promote the subsite was to STSADM export the site to a file and then STSADM import it at the toplevel.
Here are the basic commands I used:

Export subsite
stsadm -o export -url http://toplevel/sub_site/subsite -filename c:\subsite.bak -includeusersecurity -versions 4

Import subsite
stsadm -o import -url http://toplevel/subsite/ -filename c:\subsite.bak -includeusersecurity

A couple of things to note:
The -includeusersecurity switch ensures that all the columns such as modifed by, created by are maintained.

The -versions 4 switch will ensure that all versions of list items/documents are exported.

You must import/export to sites that share the same template. So a team site can only be exported and imported into another team site. You will know you are trying to import into non matching templates if you get the following error:

"The exported site is based on the template STS#1 but the destination site is based on the template STS#0"

This means that a site based on the blank template is trying to be imported into a site based on the team template. To my knowledge there is no easy way of changing a sites templates.
The following lists some of the common WSS templates:

Team SiteSTS#0
Blank SiteSTS#1
Document WorkspaceSTS#2
Wiki SiteWIKI#0
BlogBLOG#0


8 comments:

Erie Simple Sites said...

Thanks for this, was exactly the information I needed to promote a site.

Anonymous said...

Yeah, thanks! Concerning the site template: I had no problem to import a site into another configuration of the same site definition, i.e. I was able to import into a "blank site", while the original site was a "team collaboration site".

Cosmin said...

Thanks a lor, Drewberry!

Hey Anonymous guy!
I tried to import a "blank site" to a "document workspace" site and it didn't work. I received a warning that the templates are not the same and the import it's not possible. Probably it allows you to import any type of site to a "blank site", but not the other way.

Sandy said...

Great Blog info.

I need more help on SharePoint. Will you answer a question for me?

The users on the SharePoint site collection are getting repeated request for their credentials whenever they try to edit a document. I can't figure out how to fix it. I have searched everywhere and have not found an answer. Please Help me.

Side Note: My brother and husband are both Eagle Scouts from Quapaw (sp).

Piscus said...

I found a way to fix the template issue while importing:

http://www.mysharepointsupport.com/2010/05/23/sharepoint-error-cannot-import-site/

Regards!

Piscus said...
This comment has been removed by the author.
Anonymous said...

Thank you, very helpful

Haroon Rashid said...

Very Good, exact information provided to move sub sites to new site