Wednesday, July 18, 2012

Under Standing SharePoint 2010 Features

Definition Taken from Microsoft Site http://msdn.microsoft.com/en-us/library/ms460318.aspx

Features in Microsoft SharePoint Foundation reduce the complexity involved in making simple site customizations, and they are robust when upgrades are applied to a deployment. Features eliminate the need to copy large chunks of code to change simple functionality. Features thus reduce versioning and inconsistency issues that may arise among front-end web servers.
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.
Other Words you Can Say Feature is
  • Feature are Primary Deployment for SharePoint
  • Feature denied in xml (CAML) 
  • Feature contains two files feature.xml, element.xml 
  • Feature scope Farm, Web Application Site level 
  • Allow .Net Code for Execution code on Feature Installation, Activation, Deactivation and Un installation.
  • Ability to upgrade Feature versions 
Feature you can do.
  1. Install Files (Module element type)
  2. Modify the User Interface (Ribbon etc)
  3. Create Workflow
  4. Apply Property 
  5. Define Site Elements
    1. Columns
    2. Content type
    3. List
    4. Etc
Features are stored on the front-end web server in the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\FEATURES directory. The Feature subfolder includes a Feature.xml file that defines the base properties. 

Feature in SharePoint Root Folder
14hive\Templates\Features
Feature name is subdirectory of features
Contain one file feature.xml(must be as same name if it incorrect SharePoint will not recognize it Feature.xml ) contains 0 or more files. Feature element file name element.xml (by convention but you can change the name of file but this case not applied for the Feature.xml file) if it has more than one the it may not be called element.xml something else.

For Developer please the feature definition
  1. Fields feature (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\fields)
  2. Content type Feature : (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\ctypes)


Feature Schema (Required Fields are)
  • ID
  • Scope (Farm, Web Application, Site, Web)
Other Optional Fields
  • Title
  • Hidden
Choose the Scope of the Feature (mostly we used only two Scopes site and Web)
  • Site: - When feature has a Site scope it activated at Site collection level. We used when we create For example Site columns, Content type, Site Workflow thinks that available for all the sub site at site collection level.
  • Web : list definition for particular web context level 
  • Farm: Farm feature used for the global changes for your farm. Example you are going to create the separate Service that will be available to the entire farm. Or if you going to create the Timer Job that will be available for all the farm
  • Web Application: Web application feature apply to the All of the Site collection that running under specific Web application Pool.   
Feature Schema  
  • Activation Dependencies: Feature may be depending upon some other feature. This called the feature dependency we can specify the feature dependency in Feature Schema. Specify features is activate when feature is activated. Depended feature often hidden. If it not hidden during activation process dependent feature is missing error throw by SharePoint.

  • ElementMenifest 
    • ElementManifest   : Specify a file that contain a definition in a feature element.  (element.xml file)
  • ElementFile : Deploy Web part etc
  • Property : Default value of feature is key value pair( this is also called a property bags). When feature Installation, Activation, Deactivation and Un installation we can access this values.
//public override void FeatureActivated(SPFeatureReceiverProperties properties)

//{

//}
SPFeatureReceiverProperties  : Get the Property from the Property bag.
  • Upgrade Action:
    • One new feature in SharePoint 2010 is the ability to version and upgrade features.


Installing the Feature
  • Use WSP ( Web Solution package) 
  • Use Power Shell and Stsadm.exe to Install Feature/Uninstall feature
Help Full Tool For Under Standing CAML Structure 

No comments:

Post a Comment