Understanding Features and Feature Scope in SharePoint 2010

What is SharePoint 2010 Features?

  • SharePoint Features is part of Packaging and Deployment in SharePoint 2010
  • Features make it easier to activate or deactivate functionality in the course of a deployment, and administrators can easily transform the template or definition of a site by simply toggling a particular Feature on or off in the user interface.
  • Features are stored under %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\FEATURES
  • The Feature subfolder includes a Feature.xml file and any number of supporting element files.
  • Features can be installed/uninstalled using STSADM tool, SharePoint Management Shell, Or Object Model.

Understanding Feature Scope

  • Sharepoint 2010 Can be scoped to Farm, Web Application, Site Collection, and Web Site level.
  • Feature Scope id defined by Scope attribute in feature.xml
  • Sample Feature will look like this

<Feature Id=”F62C96CF-79FD-44be-8882-E9BFBD199184″

Title=”Feature Title”

Description=”Feature Description”

Version=”1.0.0.0″

Scope=”Site”

Hidden=”false”>

</Feature>

Web Site scoped Feature (Scope=”Web”)

  • Web Site Scoped feature can be activated at individual Web site level.
  • List Instances, Event Receivers, Custom Actions etc are the custom elements for Website scope features.
  • It can be activated by STSADM command like ” stsadm “o installfeature “name FeatureFolderName “url http://sharepointserver/site/subsite
  • Alternatively open site features page by site actions -> site settings -> modify all site settings ->site features and click activate.

Site Collection scoped Feature (Scope=”Site”)

  • Site Collection Scoped feature can be activated at the site collection level.
  • It can contains item that can apply to Site Collection as a whole like content types that are shared across the site collection, as well as items that can be activated per site for e.g. List Instances, Event Receivers, Custom Actions etc
  • It can be activated by STSADM command like ” stsadm “o installfeature “name FeatureFolderName “url http://sharepointserver/site/sitecollectionname
  • Alternatively open site features page by site actions -> site settings -> modify all site settings ->site features and click activate.

Web Application scoped Feature (Scope=”WebApplication”)

  • Web Application Scoped feature can be activated at the Web application level.
  • It can contains item like administrative web application links, delegate control registrations, document forms registration etc.
  • It can be activated by STSADM command like ” stsadm “o installfeature “name FeatureFolderName “url http://sharepointserver
  • Alternatively open Manage Web Application Features from Central Administrator Central Administrator -> Application Management -> Manage Application Features and click activate.

Farm scoped Feature (Scope=”Farm”)

  • Farm Scoped feature can be activated at the Farm level.
  • It can contain number of element like application logic etc which can be applicable anywhere within deployment. It contacts links to /_layouts pages and files, /_admin pages etc.
  • It can be activated by STSADM command like ” stsadm “o installfeature “name FeatureFolderName
  • Alternatively open Manage Farm Features from Central Administrator Central Administrator -> Operations -> Manage Application Features and click activate.
  • Farm scope feature will be activated automatically once it is installed on server.

References

http://msdn.microsoft.com/en-us/library/ms460318.aspx

http://www.etechplanet.com/blog/understanding-scope-of-sharepoint-features-(wss-30moss-2007).aspx