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.

Blogs

See More Articles

Contact us

To begin your digital transformation, get in touch.

We’re pleased to address any inquiries you might have and assist you in selecting the service that best suits your requirements.

Your benefits:
Speak To Us