Feature/Site Template Association

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Feature/site template associations allow you to associate new Features and functionality with existing site definition configurations so that, when sites are provisioned, the Features are automatically included in provisioning. Two Features are involved in a Feature/site template association: the Feature containing the functionality you want to add to an existing site definition configuration, and the Feature/site template association Feature itself, usually declared at the farm or Web application level, which binds the first Feature to the configuration.

Possible scopes:

  • Farm: Yes

  • Web Application: Yes

  • Site Collection: Yes

  • Web Site: No

Example

The following example shows the format of the Feature.xml file for a Feature/site template association:

<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="82E2EA42-39E2-4B27-8631-ED54C1CFC491"
  Title="Feature_Title"
  Description="Feature_Description"
  Version="12.0.0.0"
  Scope="Farm"
  xmlns="http://schemas.microsoft.com/sharepoint/"
  DefaultResourceFile="_Res">
  <ElementManifests>
    <ElementManifest Location="Feature_Elements.xml"/>
  </ElementManifests>
</Feature>

The element file for the preceding Feature.xml file might look like the following:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <FeatureSiteTemplateAssociation Id="29D85C25-170C-4df9-A641-12DB0B9D4130" TemplateName="STS#0" />
  <FeatureSiteTemplateAssociation Id="29D85C25-170C-4df9-A641-12DB0B9D4130" TemplateName="STS#1" />
  <FeatureSiteTemplateAssociation Id="29D85C25-170C-4df9-A641-12DB0B9D4130" TemplateName="BDR#0" />
  <FeatureSiteTemplateAssociation Id="29D85C25-170C-4df9-A641-12DB0B9D4130" TemplateName="SPS#0" />
</Elements>

You can also globally associate a Feature with all Web site creation through all-site definitions on the front-end Web server. Associate the Feature with the global site definition by specifying GLOBAL#0 for the TemplateName attribute. Whenever you create a site the global site definition is applied, and so your Feature will also be applied.

For more information, see Feature/Site Template Associations.