<!--[endif]-->
Features are SharePoint Server 2010–specific declarative (XML) programming elements. Features configure, associate, define, create, and copy.
Features are most commonly used for the following:
- To define the columns that make up list types and the fields that the columns are based on
- To copy Web parts and master pages to their respective galleries
- To associate Visual Studio workflows with a list or site
- To modify and extend the configuration of the SharePoint Server 2010 user interface
- To serve as a control panel that allows code and configuration changes to be turned on and off in the browse
Note: Features can affect four different scopes: farm, Web application, site collection, and site. Site-scoped and site collection–scoped features can be controlled by information workers, which allows farm administrators to delegate responsibility for them
Feature Location:
Features are XML files and must be contained in a folder in C:\Programs Files\CommonFiles\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES
Basic Know-how:
Features are generally composed of two types of files: a feature header file and one or more element files. Because the feature files are simply XML and because they are located in TEMPLATE\FEATURES, they can be easily inspected by browsing to the appropriate folder and examining the contents of the files. Feature header files are generally named Feature.XML
Feature Life Cycle
There is a four-stage feature life cycle
- Features are installed, activated, deactivated, and uninstalled
- Features can be manipulated with Stsadm.exe, Central Administration,and Windows Power Shell
- Features are deployed using solution packages with either full-trust or sandboxed deployment mechanisms
How to install a Feature:
Features are deployed with solution packages and should be automatically installed when deployed. Although it is uncommon to have to manually install features, you should know what the installation process does to install features
To install a feature, the necessary feature files must already be deployed to the TEMPLATE\FEATURES directory on all servers in the farm. Installing a feature simply makes it available to be activated. Any installed feature that does not have the property Hidden=True can be seen and activated through the SharePoint Server 2010 user interface
Features must be installed using either Stsadm.exe or Windows Power-Shell.
Stsadm.exe is located in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN. To install a feature using Stsadm.exe, use the following
command:
stsadm.exe -o installfeature {-filename | -name } [-force]
To install a feature using Windows PowerShell, use the following command:
Install-SPFeature -Path [-AssignmentCollection ] [-Confirm []] [-Force ] [-WhatIf []] []
How to Activate/Deactivate features:
To activate or deactivate a farm-scoped feature using Central Administration, do the following:
- Browse to Central Administration, System Settings, Manage Farm Features
- Click either the feature’s Activate or Deactivate button
- To deactivate a feature, confirm the deactivation
Activating Web application–scoped features in Central Administration has changed considerably and is now accomplished using the new management Ribbon
To activate a Web application–scoped feature, do the following:
- Browse to Central Administration, Application Management, Manage Web Applications
- Click the row that contains the Web application that the feature should be activated on
- Click the Web Application tab in the management Ribbon
- Click the Manage Features button in the management Ribbon
- Click either the feature’s Activate or Deactivate button
- To deactivate the feature, confirm the deactivation
Activating and Deactivation Features in Site Collection
If a feature has been installed to the farm and scoped to a site collection, a site collection administrator can then either activate or deactivate the feature. To activate or deactivate a site collection–scoped feature, do the following:
- Open the appropriate site collection in the browser
- From the Site Actions drop-down menu, click Site Settings
- Click the Site Collection Features hyperlink in the Site Collection Administration group,If the Site Collection Administration group contains a Go To Top Level Site Settings hyperlink, click on it to go to the top-level site, and then click the Site Collection Features hyper-link.
- Click the Activate or Deactivate button
- To deactivate a feature, confirm the deactivation
Activating and Deactivation Features in a Site
If a feature has been installed to the farm and scoped to a site, a site owner can activate and deactivate the feature. To activate or deactivate a site-scoped feature, do the following:
- Open the site in the browser.
- From the Site Actions drop-down menu, click Site Settings
- Click the Manage Site Features hyperlink in the Site Actions group
- Click the Activate or Deactivate button
- Confirm the deactivation
Activating and Deactivation Features using STSADM.EXE
Features can also be activated and deactivated from the command line using Stsadm.exe. Activate or deactivate features using the appropriate stsadm.exe command:
stsadm.exe -o activatefeature {-filename | -name | -id } [-url ] [-force]|
Or
stsadm.exe -o deactivatefeature {-filename | -name | -id } [-url ] [-force]
Activating and Deactivation Features using Windows PowerShell
Windows PowerShell uses a slightly different naming system than Stsadm.exe and
the user interface. Instead of using the activate and deactivate parameters, Windows PowerShell use the verbs Enable and Disable. To activate (enable) or deactivate(disable) features with Windows PowerShell, use the appropriate cmdlet:
Enable-SPFeature -Identity [-AssignmentCollection ][-Confirm []][-Force ] [-PassThru ] [-Url ][-WhatIf []] []
Or
Disable-SPFeature -Identity [-AssignmentCollection ][-Confirm []][-Force ] [-Url ] [-WhatIf []][]