views:

427

answers:

1

I created a site definition that I will use as a site template for a SPWeb object. My web can only be provisioned as a child of a site (SPSite) using a certain Sharepoint template. When I provision the web I want several features that compose my custom site definition to be activated at web level, and several other to be activated at site level (for the parent site). How can I achieve this?

A: 

When you create a Site Definition, you will have a Tag called Configuration that has Sub Tags called WebFeature and SiteFeature.

You can specify all the Features ID in the respective section so that you will have those Features activated when you create a Site out of it.

 <Configuration ID="0" Name="Basic">      
  <SiteFeatures>
    <Feature ID="00BFEA71-1C5E-4A24-B310-BA51C3EB7A57" />
    <!-- Three-state Workflow Feature -->
    <Feature ID="FDE5D850-671E-4143-950A-87B473922DC7" />
  </SiteFeatures>
  <WebFeatures>
    <Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5" />
    <!-- TeamCollab Feature -->
    <Feature ID="F41CC668-37E5-4743-B4A8-74D1DB3FD8A4" />
    <!-- MobilityRedirect -->
  </WebFeatures>

</Configuration>

Hope this helps

Kusek
But will the features activate on the site if I create a web out of the template as a child of the site?
iulianchira
I ended up doing programatically, when i provision the web I also add the features to the parent site feature collection.
iulianchira