Features
A SharePoint feature is a collection of SharePoint elements that can help to accomplish a particular functionality. Features reduce the complexity involved in making simple site customizations, and are robust when upgrades are applied to a deployment.Definition of a site or a template can be easily transformed by simply toggling a particular Feature on or off in the user interface.
For example :- Publishing features of MOSS provide all the required functionality like publishing layouts, lists, pages library, style library etc.
Features make it possible to activate or deactivate functionality.
· Features provide the following capabilities
· Pluggable behavior for installing or uninstalling Features within a deployment.
· Pluggable behavior for activating or deactivating features at a given scope.
· A scoped property bag for storing data required by Features within its scope.
Feature Implementation
All the features in MOSS should be at [WSS]\Template\Features folder.
Each Features sub-folder must include a Feature.xml file that defines the base properties of a Feature and lists of the element manifests associated with it. Element manifests are XML files whose top level <Elements> tag contains definitions for elements that support the Feature.
Feature.xml: Following are the main tags of Feature.xml
|
Attribute
|
Required
|
Description
|
|
Id
|
Yes
|
Contains the globally unique identifier (GUID) for the Feature.
|
|
Title
|
No
|
Title of feature
|
|
Description
|
No
|
Description of the feature.
|
|
Version
|
No
|
Version of feature
|
|
Scope
|
Yes
|
Feature can be scoped at following level.
· Farm
· Web Application
· Site: - Site collection level
· Web: - Web-Site
|
|
Hidden
|
No
|
True: - To hide it from UI (Site features)
False: - To display in UI (site features)
|
|
ReceiverAssembly
|
No
|
Specifies the strong name of the signed assembly located in the global assembly cache from which to load a receiver to handle Feature events
|
|
ReceiverClass
|
No
|
Specifies the class that implements the Feature event processor.
|
Element Manifests: It contains references to element manifests and element files that contain definitions for the Feature elements.
Element Manifest: - Specifies a file that contains a definition for a feature element.
|
Attribute
|
Required
|
Description
|
|
Location
|
Yes
|
Specifies the relative file path to the root element manifest file.
|
ElementFile: Specifies a support file required for the Feature.
|
Attribute
|
Required
|
Description
|
|
Location
|
Yes
|
Specifies the relative file path to the support file for the feature.
|
Properties: It contains the default values for feature properties.
Element manifest file: Following are the element types for feature.
|
Element
|
Description
|
|
ListTemplate
|
Contains a list definition
|
|
ListInstance
|
Create a List Instance based on some already exist list template.
|
|
Field
|
For creating site columns
|
|
Module
|
Contains the set of files with which to provision sites.
|
|
FeatureSiteTemplateAssociation
|
To associate new Features and functionality with existing site definitions or site templates so that, when sites are provisioned, the Features are automatically included in provisioning.
|
|
Receiver
|
Contains an item event receiver registration.
|
|
ContentType
|
Schema definition which can be reuse and apply to multiple list definition.
|
Install features:
Installation makes aware the entire front-end web server about the feature definition. Installed Feature will display the Features in the list of available Features.
Before installing feature sub-folder should be present in [WSS]\Template\Features
Where generally
[WSS] = C:\Program Files\Common Files\Microsoft Shared\web server extension\12\TEMPLATE\Feature
stsadm –o installfeature –name <Name of feature>
Uninstall Feature
stsadm –o installfeature –name <Name of feature>
Feature Activation
To use the functionality associated with Feature, it must be activated at required scope.
Suppose a feature is developed for creating a list instance based on default custom list at Web Scope. List instance will be created only if the feature is activated at the required web site.
A Feature can be activated in following ways
Through the Site Settings Web pages: - Go to “Site settings ->Site Features” to activate a feature.
The STSADM command line:-
stsadm –o activatefeature –name <Folder name >