I am happy to announce the release of SharePoint Site Configurator Updated for SharePoint 2010 and packed with a lot of new features!
There were three main reasons for creating the Site Configurator feature:
1. In some scenarios there is a need for being in as much control of the site provisioning process as possible; making sure what gets created in what order.
2. A wish to reuse as much custom functionality as possible.
3. Making site provisioning as easy as possible, because sometimes developers found it hard to use and understand the built-in provisioning mechanisms.
Provisioning site process of SharePoint
The term provisioning is used to describe the process of creating a new SharePoint site and making it available for end-users. There are several steps in the creation process and SharePoint provisions in the following order:
- Global onet.xml
This file defines list templates for hidden lists, list base types, a default definition configuration, and modules that apply globally to the deployment.
- SPSite scoped features defined in site definitions onet.xml, in the order they are defined in the file.
The onet.xml file defined in the site definition can define navigational areas, list templates, document templates, configurations, modules, components, and server e-mail footers used in the site definition to which it corresponds.
- SPSite scoped stapled features, in quasi random order
- SPWeb scoped features defined in onet.xml, in the order they are defined in the file.
- SPWeb scoped stapled features, in quasi random order
- List instances defined in onet.xml
- Modules defined in onet.xml
This is a fairly complex process and it can often be hard to know the method for customizing a site definition. A solution can be right in one scenario and completely wrong in another, making this somewhat confusing.
If you want to catch up on site definitions or other parts of this process take a look at the following links, Site definitions and configurations and How to: Create a Custom Site Definition and Configuration.
Site Configurator is attaching to step 5, as a web stapled feature, as late in the out-of-the-box (OOB) provisioning as possible. Omitting steps 2, 3 and 4 is also recommended and will be the case if you use the blank site definition template as a starting point.
Once the Site Configurator is activated, it reads a siteconfigurations.xml file from its feature folder. The file consists of configuration elements, ie. custom settings, web parts, list instances, other features to activate, and then configures your site according to the specifications.
In order to make Site Configurator handle customization of your site, you need to complete three steps with an optional fourth:
1. Create a Site Configurator feature
2. (Optional) Create a new site definition
3. Staple the Site Configurator feature to a site definition.
4. Deploy and create a new site.
Make sure you generate and use your own IDs for the features you create!
The Site Configurator needs to be triggered to start making the configurations of your site. A feature receiver is used as this trigger. The feature simply points to the feature receiver in the “sharepointsiteconfigurator.dll”:
<?xml version="1.0" encoding="utf-8" ?>
ReceiverAssembly="SiteConfigurator, Version=22.214.171.124, Culture=neutral, PublicKeyToken=4d009ee268a83a6d"
<ElementFile Location="SiteConfigurations.xml" />
Also, this feature must contain the “siteconfigurations.xml” file, which defines the configurations to apply. A minimal example:
<?xml version="1.0" encoding="utf-8" ?>
This configuration will apply the theme “Simple” to a new site, if the site is made from the site definition “SITEDEFINITIONEXAMPLE” and configuration number “0” (“#0”)
Creating a new site definition is described on http://msdn.microsoft.com/en-us/library/ms454677(office.14).aspx
On the Codeplex site we’ve included a sample definition which you can use as a starting point, and this site definition is used as reference in this document.
This configuration will apply the theme “Simple” to a new site, if the site is made from the site definition “SITEDEFINITIONEXAMPLE” and configuration
<?xml version="1.0" encoding="utf-8"?>
<!– The feature will be stapled (activated) on all sitedefinitions you list here–>
<FeatureSiteTemplateAssociation Id="499bb3bb-9363-4f3d-a96d-1d69948c2cf3" TemplateName="SiteDefinitionExample#0" />
The ID provided here is the ID of the feature to staple, in this instance the ID of the Site Configurator feature created in step 1.
In the solution available on the project site, a Site Configurator feature and a Farm Stapler are included. You should use these files as examples on how to set up your own solution.
After completing these steps, build your solutions in Visual Studio. This will create .wsp files. Either deploy them with use of Visual Studio, PowerShell or STSADM.exe. The deploy will copy the solution(s) to SharePoint and place the siteconfigurator.dll the GAC (Global Assembly Cache ie. c:\windows\assembly) and the features and their configuration files are deployed to the SharePoint 14 catalog (14 hive).
Creating a new site of the type specified in step 3, will now trigger the Site Configurator and configure the site according to the specifications in the siteconfigurations.xml file.
For more information go to the SharePoint Site Configurator site.