Versjon 1.0 Released on 16. January!Project DescriptionSharePoint 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 descriptionSeveral 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.
BackgroundThe 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!
DetailsThe SharePoint Site Configurator Feature consists of these elements:
- Microsoft.MCS.FeatureStapler: The stapler Feature binding the staplee to an OOB blank site definition
- Microsoft.MCS.SiteConfigurator: The staplee Feature which is the SiteConfigurator
- SiteConfiguration.xml: The xml-file holding the settings for the site(s)
In addition these files might also need to be added/modified
- /12/Template/<localeid>/XML/webtemp<your>.xml: The site with the stapler as it appears in the "Create site"-dialog
- /12/Template/SiteTemplates/<the site definition that has the stapler, a copy of a blank site definition>
SharePoint Site Configurator Feature example solution
Execution SequenceThis is how the process of creating a site happens:
- A site is created that has the feature stapled
- 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
DeactivationIf 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-schemaExample of a configuration xml file
SiteConfigurations_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.
LoggingThe feature is logging information and errors with the standard SharePoint logging mechanisms
Known limitationsWeb part connections cannot be configured
Web part toolbar cannot be configured
Team Blog