fbpx

May 17, 2011

SharePoint feature stapling with site definition

SharePoint feature stapling with site definition

I have created a site definition, there are many ways to use features with this site definition,

You can create a site from this site definition and deploy feature on that newly created site, you can also include features in onet.xml of site definition file and then create site from it. Another way to do is by feature stapling which associate your feature to the site definition.

In this blog I will demonstrate how you can use feature stapling to associate your features with site definition.

To use the  stapling, you need features which you like to map with the site definition.

You need to create a second feature which does the stapling.  The solution sample is given below

<?xmlversion="1.0"encoding="utf-8"?> 
<Solutionxmlns="http://schemas.microsoft.com/sharepoint/"SolutionId="0579AAC2-9E7E-478E-AFE9-D5EC426055E4">
  <FeatureManifests>
    <FeatureManifestLocation="EB.MyDemo.FeatureStapling\feature.xml" />
  </FeatureManifests>
</Solution>

Note: The feature stapling will not affect any sites which have been already created from a site definition, only subsequent site will take the affect. But you can activate features individually on the site.

  • Related Tags:

(2) Comments

Leave a comment