I am developing publishing site and it will have complex tree structure.
Is there any way to deploy site structure (multiple sub sites - SPWeb) using SharePoint solution?
I know I can create site tree programmatically.
views:
894answers:
2I have been on a project with the same needs, but we didn't find the answer with the OOTB functionality of the feature framework. We also had to go through the object model and do the creation programmatically.
But instead of hard-coding the site structure, we took a different approach. Our solution was to implement a generic SiteCreation feature that takes an xml file as input. The xml defines the site structure and is read by the feature receiver which parses it and creates the specified sites.
I know that there is some coding involved in this solution, but I think the extra work is well spent, since the site structure will likely change numerous times before it reaches production.
The default publishing portal (and collaboration portal) site definitions use a portal provisioning class to build the site structure based on an xml file (this is all out of the box for a MOSS installation).
You can see how the provisioning class is referenced in the webtemp file for the portal site definitions (12\TEMPLATE\1033\XML\webtempsps.xml). An example of the actual xml documents that are used can be found in 12\TEMPLATES\SiteTemplates\WebManifest - it's a fairly straight forward schema.
If you are creating a custom site definition based on publishing portal then you can re-use the provisioning class and provide your own xml document to build your custom site structure.