Thursday 3 May 2012

Scope and Sequence in Feature stapling - Sharepoint 2010

Some important tips about Scope and Sequence that you need to be aware of while implementing Feature stapling in Sharepoint 2010.

 
Firstly Scope - The Scope of the stapler feature is always Farm. Also, If you want to staple a feature to all site definitions then you can staple it to the GLOBAL (GLOBAL#0) site definition and it will be added to all sites that are created.

 Stapler Scope and Sequence of Activation -  Farm scoped features are activated in the below order.
  • Features from site definition
  • Features without activation dependencies from stapler
  • Features with activation dependencies from stapler (in correct sequence)
When using WebApplication scope there does not seem to be any specific order.

Following test Scenarios will be very helpful in developing feature stapling soltuions.
Scenario Activation Type Success? Notes
Activate hidden site-scoped feature using staple feature Automatic Yes Staple feature can be used to activate a hidden site-scoped feature.
Activate visible site-scope feature using staple feature Automatic No Staple feature cannot be used to activate a visible site-scoped feature.
Activate hidden web-scoped feature using staple feature Automatic Yes Staple feature can be used to activate a hidden web-scoped feature.
Activate visible web-scoped feature using staple feature Automatic Yes Staple feature can be used to activate visible web-scoped features.
Activate web-scoped feature using a stapled hidden site-scoped feature Automatic No Hidden features cannot activate other features.
Manually activate web-scoped feature with dependency on another visible web-scoped feature Manual Yes Manually activating a web-scoped feature can be used to activate another web-scoped feature.
Manually activate web-scoped feature that has a dependency on a hidden site scoped-feature Manual No Web-scoped feature cannot activate a hidden site-scoped feature. This would be a cross-scoped feature that attempts to activate a feature across scopes to a higher level scope.
Manually activate site-scoped feature using a web-scoped feature Manual No Although web-scoped features can have dependencies on site-scoped features they cannot activate them.

Reference - http://sharepoint.microsoft.com/Blogs/GetThePoint/Lists/Posts/Post.aspx?ID=607

No comments:

Post a Comment