I faced this problem in one of my projects. There were many custom site definitions beings used in the organization & few were all messed up; so they wanted me to change the site definition of all the existing sites to just one custom site definition.
Solution:
Now there are two supported ways of changing a site's site definition. Yeah! you heard it right. It is supported by Microsoft.
First way is using the sharepoint deployment API. You can refer to Stefan Gobner's blog on this:
http://blogs.technet.com/stefan_gossner/archive/2007/08/30/deep-dive-into-the-sharepoint-content-deployment-and-migration-api-part-4.aspx
I personally found it difficult, so i analyzed the manifest.xml & did lot of testing to find another simpler solution which doesn't use SharePoint API but does the same thing.
Note: you cannot save site as template (.Stp) because it has limitation of maximum 10MB size which makes the approach useless
The second way is to manipulate the manifest.xml directly
Steps:
For that go to
4) Import this site back to its place. You can delete or overwrite the previous version..upto you. I would suggest taking backup first.
Solution:
Now there are two supported ways of changing a site's site definition. Yeah! you heard it right. It is supported by Microsoft.
First way is using the sharepoint deployment API. You can refer to Stefan Gobner's blog on this:
http://blogs.technet.com/stefan_gossner/archive/2007/08/30/deep-dive-into-the-sharepoint-content-deployment-and-migration-api-part-4.aspx
I personally found it difficult, so i analyzed the manifest.xml & did lot of testing to find another simpler solution which doesn't use SharePoint API but does the same thing.
Note: you cannot save site as template (.Stp) because it has limitation of maximum 10MB size which makes the approach useless
The second way is to manipulate the manifest.xml directly
Steps:
1) Find the template name, setuppath, site definition ID, Configuration ID of all the site definitions which needs to be changed as well as of the new site definition.
C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\TEMPLATE\\1033\\XML open the webtemp.xml of your site definition. after couple of lines, you will see:
ID="50">
"CustomsiteDefitionName" is template name and "50" is template ID or sitedefinition ID
What is the configuration ID for the configuration we want to use?
Our sites are using "Custom team Site", so our configuration id is "0"
In the file, you will also see SetupPath=""SiteTemplates\PUBLISHING\"; for publishing site for example.
Note down these for all site definitions in question.
2) Export the site whose site definition you want to change
stsadm -o export -url -filename [-includeusersecurity] [-versions] <1-4> -nofilecompression [-quiet]
This stsadm command will export the site, including it’s subsites, in non compressed fashion. The result will be lot of .dat or data files, few xml – important ones -> Manifest.Xml & Requirements.xml
3) Open Manifest.xml &Requirements.xml & change TemplateName, TemplateID,ConfigurationID & Setuppath of the current site definition to the new sitedefinition's one
That's it & you are almost done.4) Import this site back to its place. You can delete or overwrite the previous version..upto you. I would suggest taking backup first.
5) Njoy! your site's site definition has been changed.
Note: If your manifest.xml grows bigger (like more than 1GB), any DOM manipulation won't work on it. All DOM ways of opening big files fail since it loads everything in memory. Read my blog on how to handle it...
No comments:
Post a Comment