Creating Features


Table of Contents

What is a feature?

A feature is a modular piece of functionality that you can add to a SharePoint site. For example, SharePoint provides many features out of the box, such as ones that will create lists, modify site settings, add links to menus and so on. Features can be added to the SharePoint environment to provide additional functionality to sites as required.

How can I create custom features?

Features are created by building XML files that tell SharePoint what you feature does. These XML files are stored in the 12 hive at "C:\program files\common files\microsoft shared\web server extensions\12\template\features" and each individual feature has a subfolder in that directory. Each feature will always have a feature.xml file that describes the feature (title, id, scope etc) and can optionally have one or more feature element manifests (typically where the is only one manifest it will be called elements.xml).

There are various third party tools and add-ons for Visual Studio available to assist with the development, packaging and deployment of features, but essentially they will all have the same result which will deploy the feature XML files to the 12 hive and to tell SharePoint that the feature is there. Please see Solution package development tool comparisons for more information.

What can I do with a feature?

Features can provide different functions based on the scope of the feature. There are four different scopes that a feature can apply to:

  • Farm - features at this scope provide functionality that is relevant to the entire SharePoint farm
  • WebApplication - features at this scope provide functionality to one or more specific web applications
  • Site - features at this scope provide functionality to one or more spcific site collections
  • Web - features at this scope provide functionality to one or more specific webs (sub-sites) within a site collection

Feature Receivers

Feature Receivers allow you to hook events when Features are Activated or Deactivated. The events available are:

  • FeatureActivated
  • FeatureDeactivating
  • FeatureInstalled
  • FeatureUninstalling

Feature Elements

 Below is a table of what functional elements can be added to features based on the scope of the feature

Scope Elements
Farm Control
CustomAction
CustomActionGroup
FeatureSiteTemplateAssociation
[HideCustomAction]
WebApplication Control
CustomAction
CustomActionGroup
[DocumentConverter]
FeatureSiteTemplateAssociation
[HideCustomAction]
Site Content Type Development
Control
CustomAction
CustomActionGroup
FeatureSiteTemplateAssociation
[Field]
[HideCustomAction]
[ListInstance]
[Module]
[Workflow]
Web ContentTypeBinding
Control
CustomAction
CustomActionGroup
[HideCustomAction]
[ListInstance]
[ListTemplate]
[Module]
Event Receivers

Labels

features features Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.



Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. Hosted generously by CustomWare