V2.0 Released - Supporting both SP2010 and SP2007.

Why Site Configurator?
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:
  1. 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.
  2. 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.
  3. SPSite scoped stapled features, in quasi random order
  4. SPWeb scoped features defined in onet.xml, in the order they are defined in the file.
  5. SPWeb scoped stapled features, in quasi random order
  6. List instances defined in onet.xml
  7. 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.

Provisioning with Site Configurator
Process overview
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.

For more information, take a look at the documentation in the download section.




V1.0

Versjon 1.0 Released on 16. January! (But you might want to check out the latest check-in from the source code tab...)

Project Description
SharePoint Site Configurator Feature is a small framework for taking care of all configurations, settings and featurestapling you need for transforming a standard blank site definition into your own full blown site, without the hassle of creating a complex custom site definition.

Feature description
Several bloggers have lately argued that you should avoid creating site definitions whenever possible, and instead do the configuration through features that are stapled to "empty" site definitions. The Site Configurator feature is a feature that lets you define the most common configurations in a "shadow" site definition.

Staple this feature to a copy of a blank site definition. Enter the settings and your own features in the settings file.

Background
The goal with the SharePoint Site Configurator Feature is to minimize the need to create custom site definitions in SharePoint development projects.

Main reasons for moving away from custom site definitions are:
- No need for creating and maintaining large and complex custom onet.xml-files
- Minimize effort in a future upgrade scenario, no need for creating difficult mapping files and performing tedious tests and retests to get good results
- Better control of the site creation process, e.g. activate features in a controllable order
- Make testing/debugging of site creation a whole lot easier!

Details
The SharePoint Site Configurator Feature consists of these elements:
  1. Microsoft.MCS.FeatureStapler: The stapler Feature binding the staplee to an OOB blank site definition
  2. Microsoft.MCS.SiteConfigurator: The staplee Feature which is the SiteConfigurator
    1. SiteConfiguration.xml: The xml-file holding the settings for the site(s)
In addition these files might also need to be added/modified
  1. /12/Template/<localeid>/XML/webtemp<your>.xml: The site with the stapler as it appears in the "Create site"-dialog
  2. /12/Template/SiteTemplates/<the site definition that has the stapler, a copy of a blank site definition>
SharePoint Site Configurator Feature example solution
SiteConfigurator solution.jpg

Execution Sequence
This is how the process of creating a site happens:
  1. A site is created that has the feature stapled
  2. The Feature's FeatureActivated event kicks off the configuring of the site in this order:
ProvisionFiles
ActivateSiteCollectionFeatures
GetSiteLogoUrlProperty
SetAlternateCssUrlProperty
SetMasterUrlProperty
SetRegionalSettings
AddTopNavigationLinks
AddQuickLaunchLinks
ActivateWebFeatures
CreateLists
AddWebParts
AddListViewWebParts
UpdatePropertyBag

Deactivation
If the Feature is deactivated, this sequence of functions are run:

DeActivateSiteCollectionFeatures
DeleteTopNavigationLinks
DeleteQuickLaunchLinks
DeActivateWebFeatures
DeleteLists
DeleteWebParts
RemovePropertyBag

Note that the Top/Quick launch links and lists/webparts are deleted. This could be a non-desired behavior. The lists deletion is depending on the settings in the configuration xml.

SiteConfigurator Xml-schema
Example of a configuration xml file
word.jpgSiteConfigurations_xml_schema.docx

<SiteConfigurations>
Root element holding the different site configurations

<SiteConfiguration>
Element(s) describing one configuration which will be run for one site

<Property>
Element(s) describing site properties to be configured

<SiteCollectionFeature>
Element(s) telling Feature to be activated with site collection scope, including the activation order

<WebFeature>
Element(s) telling Feature to be activated with site scope, including the activation order

<TopNavigationLink>
Element(s) describing top navigation links

<QuickLaunchLink>
Element(s) describing quick launch links

<PropertyBag>
Element(s) for configuring properties in the site propertybag

<ListViewWebPart>
Element(s) describing list view web parts to be added to the homepage

<WebPartConnection>
Element(s) describing connections between web parts

<ListInstance>
Element(s) describing lists to be created in the site

<DeleteListInstance>
Element(s) describing lists to be deleted on Feature deactivation

<FileToProvision>
Element(s) describing files to be copied to the site.

Logging
The feature is logging information and errors with the standard SharePoint logging mechanisms

Known limitations
Web part connections cannot be configured yet



Team Blog

Last edited Jan 2 at 4:45 PM by raghuariga, version 29