SharePoint Site Definition for Multiple Subsites Creation
Written By: Shishir Bhandari -- 4/26/2011 --
(2837) comments --
Categories: Configurations, Design, MOSS 2007, SharePoint 2010, SharePoint Foundation 2010, WSS3
< Prev -
- Next >
| Become a paid author
The requirement of creating multiple SharePoint sub sites automatically, at one time, comes up at most organizations. You would think this would be really complex since it requires you to inherit SPWebProvisioningProvider, override its Provision function and do C# coding. This approach does involve a good amount of time and effort, but there is a better way which will save time writing code and will work seamlessly.
The solution lies in exploring the (out of the box ) Site Definition for Site Collection!
You must have noticed that a site collection provisions with its sub sites. For example: a Collaboration portal would come with sub sites for News and Search.
A little bit of research on how it is done reveals the steps for creating a site definition which will create a site and its sub sites automatically.
To try our approach, let’s create a publishing site (BLANKINTERNET#0 site definition) with three sub sites namely:
a. News Site using (SPSNEWS#0 site definition)
b. Press Releases site (BLANKINTERNET#1 site definition)
c. Team Site (STS#1 site definition)
To get the full list of site definition IDs, read here.
Follow the below steps:
1) Go to 12 \Template\XML (MOSS 2007) Or 14\Template\XML (SharePoint 2010)
2) Create an XML file (let’s say subwebs.xml). Open the file and paste the below text:
<?xml version="1.0" encoding="utf-8" ?>
<!—Write you Custom site and subsite info here -->
<web name="BlankInternet Site"
description="It has three subwebs" >
<web name="News site"
description="subweb 1" />
<web name="Press Releases site"
displayName="Press Releases site"
description="subweb 2" />
<web name="Team site"
description="subweb 3" />
You can change the sitedefinition, displayName and description of the sites based on which sites you want to provision.
< Prev -
- Next >