Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've seen the term "feature stapling" used around this site and some blogs. What exactly does this mean? My best guess is that it has something to do with dynamically activating features from other features.

share|improve this question
2  
It's really a question to google rather then ask a question. It's blog a lot. And the first page of search results provides answers both in general and in depth. –  Yuri Leontyev Apr 18 '12 at 6:55
9  
Hmm. For one, I feel that asking it here lets the answers get peer-reviewed, and thus I can feel more confident the answer is correct. Also, SPArchaeologist's answer below is very concise and to the point; even if it is redundant with answers on the web, it's the answer that really made it click for me. Additionally, I really like the format of StackExchange sites, and would prefer as much content to live here as possible. But these are my opinions, and I'm not sure how squarely they line-up with the rules of this site.. –  Daryl Apr 23 '12 at 0:24
1  
I'm with Daryl. I've googled and bing'd "feature stapling" and not one useful post could I find after a half-hour. Posting here would hopefully provide some noise filtering and deliver better results than say, fruitless wading through msdn. –  Alan M Jun 28 '12 at 19:32

1 Answer 1

up vote 20 down vote accepted

Feature stapling is a tecnique that allows for a feature to be stapled to a site definition by using a support "stapler" feature that defines which features are attacched to which site definition.

This allows for a feature to be automatically activated on a site created from a site definition without the need to modify the definition files (onet.xml). This also means that:

  • you can use stapling to attach features to ootb definitions,
  • you can use it to "modify" a custom definition that has already been deployed and it's in use.

Anyway, you must remember that stapling does not affect sites that have already been created: the stapled feature will be activated only on new site, so you will need to manually activate the feature on any old site you may have.

To create a feature stapling infrastructure you will need at last two feature: the feature that needs to be stapled (ie: the feature you want to be automatically activated) and a feature that performs the stapling associaton. Es-Take the following element.xml file taken from a sample stapler feature:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <FeatureSiteTemplateAssociation Id="00BFE171-1B17-4F72-28CB-1171C0140130" TemplateName="STS#0" />
  <FeatureSiteTemplateAssociation Id="00BFE171-1B17-4F72-28CB-1171C0140130" TemplateName="STS#1" />
  <FeatureSiteTemplateAssociation Id="00BFE171-1B17-4F72-28CB-1171C0140130" TemplateName="STS#2" />
</Elements>

As you see to define the stapling accociaton, the tag "FeatureSiteTemplateAssociation" is used. You will need to specify the ID of the feature that should be stapled, followed by the name of the site definiton the feature will be attacched to. Just remember that the site definition name should be in the # format.

Also, have a look to this msdn page that explains some further details (taken from the 2007 docs, but it's still valid for 2010).

share|improve this answer
4  
Check this SharePoint magazine article for detailed steps too - sharepointmagazine.net/articles/… –  Deepu Nair Apr 16 '12 at 6:35
2  
@DeepuNair I don't think this link is anymore active. –  Sane.Amit Feb 10 at 13:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.