Friday, June 4, 2010

Restore publishing site via Sharepoint Designer into root web site of site collection

In one of my previous posts I summarized ways to copy sites in Sharepoint. In this post I will describe how to copy site into root web site of site collection (SPSite.RootWeb). Sharepoint Designer allows to backup and restore sites with its subsites. In order to do it you need perform the following steps:

  1. Open site you want to backup in Sharepoint Designer
  2. Select Site > Administration > Backup Web Site and check "Include subsites in archive"
  3. Select location for backup file (.cmp)

In order to restore backuped site you need:

  1. Create empty destination web site (in Sharepoint Designer open site to which subsites collection you want to restore backuped site and select File > New > Web Site tab > General > Empty Web Site)
  2. With opened empty web site in Sharepoint Designer select Site >Administration > Restore Web Site and select backup file

It is important that destination site should be empty. In other case Sharepoint Designer will not restore site with message that destination site is not empty. But what if we need to restore site into root site of site collection? The problem is that you can’t create site collection without root web site via UI. Although it is possible via stsadm –o createsite command without sitetemplate parameter (see http://technet.microsoft.com/en-us/library/cc262594(office.12).aspx). But there is possibility to create site collection with “Empty Site” template for root web site in Central Administration. Although in this case root web site will not be empty Sharepoint Designer will allow to restore backuped site in such destination site.

Unfortunately if your backuped site is publishing site (site with activated publishing infrastructure features – e.g. Publishing Portal) Sharepoint Designer will not activate publishing infrastructure on restored site in this case. So event if your web site was restored successfully you will not have functionality added by publishing infrastructure (e.g. Site Master Page Settings). You can try to activate it after restoring in Site Settings > Manage Site Features > Office SharePoint Server Publishing Infrastructure but it can fail or can lead to unpredictable issues (as you already used some publishing artefacts like Pages doclib during restoring).

So I suggest to do one more step after you created new site collection with “Empty Site” template for root web site: activate Office SharePoint Server Publishing Infrastructure on this empty site. And only after this restore site in Sharepoint Designer. You can’t create site collection with some existing publishing sites templates for root web site as Sharepoint Designer will not allow to restore site in it with message that destination site is not empty.

After performed steps you will be able to restore publishing site into root web site of site collection via Sharepoint Designer.

Update 2010-06-09: restoring of regular web site (SPWeb) into root web site of site collection is not enough. There are many other issues which should be fixed after that (e.g. activate the same features of site scope, fix navigation, etc). Check this article of Gary Lapointe for details: Convert a Sub-site to a Site Collection. Shortly you should run the following command on your server after web site was restored:

stsadm -o gl-repairsitecollectionimportedfromsubsite –sourceurl http://example.com/source -targeturl http://example.com/target

It should fix most of problems. But several issues may exists after it. For example, you should manually fix DataFormWebPart and ContentByQueryWebPart web parts in order to retarget them on new location.

No comments:

Post a Comment