Feature in SharePoint
Features
Microsoft Windows SharePoint Services features are collections of logically related items and operations that can be added to and used repeatedly across site definitions.
Advantage: Features reduce versioning and inconsistency issues that can arise among front-end Web servers. Feature activating or deactivating functionality in the course of a SharePoint deployment easier.
Implementing Features
To implement a feature, you need to add a subfolder that contains the feature’s definition to the Features setup directory at the following location:
\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES
OR
\Program Files\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\FEATURES
Solutions structure can be like below:-
Here “Home.Project.Solution.MyDocs” is custom folder name which contains feature and elements xml file.
The Structure of Feature.xml
A Feature.xml file can contain the following elements:
Feature
..ActivationDependencies
….ActivationDependency
..ElementManifests
….ElementFile
….ElementManifest
Feature Scope
Features can be scoped at the level of a site, site collection, Web application (virtual server), or server farm. A particular feature can be activated for a single scope. The scope of a feature is determined by the value of the Scope attribute of the Feature element.
■ Web Site scope Feature (Scope=”Web”): A Web Site scoped Feature is one that can be activated only at the individual Web site level .
■ Site Collection scope Feature (Scope=”Site”): A Site Collection scoped Feature is one that can be activated at the site collection level and contains items that apply to the site collection as a whole (for example, content types that are shared across the site collection), as well as items that can be activated per site (for example, list instances, etc).
■ Web Application scope Feature (Scope=”WebApplication”): A feature scoped for a Web application, or virtual server, can be activated or deactivated and can contain the elements for virtual server assemblies.
■ Farm scoped Feature (Scope=”Farm”): A farm feature is scoped for an entire server farm. A farm feature can contain links to _layouts pages and files, _admin pages, and other elements
Activation Dependencies and Scope
A feature can be dependent on another feature activation. Activation dependencies can be expressed for features of the same scope, or a feature at a particular scope can be dependent on a feature at a different scope (a cross-scope activation dependency).
For example:- Below feature can be activated if site has enabled publishing feature.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?xml version="1.0" encoding="utf-8" ?> <Feature Id="0000001-00001-00001-00001" Title="Test feature Services" Description="This activate if publishing feature enabled on site." Scope="Site"> <ActivationDependencies> <ActivationDependency FeatureTitle="Publishing Infrastructure" FeatureDescription="Publishing Infrastructure need to be activated prior to deploying the Custom PageLayouts, Site Content Types and Site Columns feature." FeatureId="f6924d36-2fa8-4f0b-b16d-06b7250180fa" /> </ActivationDependencies> </feature> |
Creating Custom feature
Here I am going to give below article url where I have implemented custom feature. Visit these to understand how you can implement custom feature.
- Create and Deploy custom webpart
- Custom action in sharepoint
- Feature Receiver
- Adding list event on specific list.
Thanks & Regards,
Avinash
April 22, 2012
·
Infoyen ·
No Comments
Tags: Custom Feature in sharepoint, feature sope, MOSS, SharePoint, SharePoint Feature · Posted in: MOSS, SharePoint
Leave a Reply