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 Aug 19 at 10:10 AM by StianKirkeberg, version 24

 

Want to leave feedback?
Please use Discussions or Reviews instead.

Updating...
© 2006-2009 Microsoft | About CodePlex | Privacy Statement | Terms of Use | Code of Conduct | Advertise With Us | Version 2009.10.27.15987