Restoring a backup of a sharepoint site when the LCID is different
Posted on Monday, 02 August 2010 19:37We currently have around 100 site collections in English, and we want to replicate the structure in Welsh. I thought this would be easy, but I was wrong.
Before anyone asks me why I'm not using SharePoint variations, it's because I find them completely useless and not suitable for the business needs. I understand files need to be manually duplicated but we already have our own CMS solution in place which handles everything quite nicely.
My original plan was this:
- Script the backup of a site collection via STSADM
- Programatically create a new site collection in Welsh
- Restore the backup using STSADM command to the new site collection
- If the backup changed the site's language, change it back with the SPWeb.Language feature
- As it's a publishing site, disable / enable the PublishingSite feature to fix several issues after restoring an entire site collection from a backup
- Move on
Things started well, the code to programatically backup the site worked a treat, as did the creation of the new site collection, but then came the restoration. It failed, and looking through the log files I came across some bad news:
[8/2/2010 3:44:12 PM]: FatalError: Cannot import site. The exported site is using language 1033 but the destination site is using language 1106. You can import sites only into sites that are using same language as the exported site.
Then, I found out that the SPWeb.Language property was read only. I then found how to change the site LCID in the database, but then was unable to disable and the enable the PublishingSite feature as (roughly translated by google) the list already exists. After much trial and error I managed to get everything working, and here's how.
1. Create the site collection in the same language as the backup (1033 in this case).
2. Restore the backup to the new site collection.
3. Enable / Disable the PublishingSite feature.
4. Change the language in the database. To do this, go into SQL Management Studio, Go to the content database containing the site, and open up the Webs table. Looking through here you'll find your site and its sub-sites. Looking through the columns you'll find one called Language. Update all of the entries to your site from the original one (e.g. 1033) to the target language, in our case 1106.
Now, when you access the publishing site everything should be in place and using the new language.