Venkata Polepalli
What is a SharePoint Feature?
By Venkata Polepalli in SharePoint on Sep 21 2013
  • Swatismita Biswal
    Jun, 2015 17

    Features represent a set of functionality (code) that can be activated and de-activated at various levels in SharePoint. Using Features, you can do everything from adding a link to the Site Settings page to creating a complete fully functioning Project suite that can be added to any SharePoint site. Developers can scope feature to the following level - . Web . Site . WebApplication . Farm

    • 2
  • Venkata Polepalli
    Sep, 2013 21

    v A Feature is a container of various defined extensions for SharePoint Server 2010, and is composed of a set of XML files that are deployed to front-end Web servers and application servers. You can deploy a Feature as part of a solution package, and you can individually activate a Feature in SharePoint Server sites.

    Features are packages of functionality that you can activate and deactivate in SharePoint farm. They have four possible scopes:

    ü Farm: A farm level feature, as the name suggests, is something that affects the whole farm, for example provisioning a custom timer job or deploying a Business Connectivity Services model.

    ü Web Application: A web application feature can be activated so that it only affects a single web application, and a typical example is a feature that modifies the web.config file.

    ü Site: A site scoped feature can be activated so that it only affects a site collection, an example being the deployment of a master page to the master pages catalogue.


    ü Web: Finally, a web scoped feature can be activated for a single site, for instance setting the default master page for that site.

    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 turning on or turning off a particular Feature in the user interface

    When to use Features

    Features are the recommended method for deploying pieces of functionality, customizations, or configuration changes to front-end Web servers. Features are a flexible way to manage functionality through its lifecycle, including activation, upgrade, and eventually deactivation.

    You can use Features to deploy developed site elements in one or more of the following scenarios:


    Need for activation and deactivation   When you deploy site element customizations in a Feature, you can install, activate, and deactivate the Feature by using Windows PowerShell or by using the object model. You can also activate and deactivate a Feature by using the Central Administration Web site.


    Flexibility of scope   You can activate a Feature for a single scope, including farm, Web application, site collection, or Web site.

    Ease of distributed deployment   A Feature is easy to deploy to multiple server farms as part of a solution.


    Control through the Feature object model   The Feature object model enables you to specify the list of installed features within a given scope and to control whether features are enabled at the farm and site levels.

    Use solution packages to package Features to deploy to different environments. For example, use a solution package to deploy customizations between developer workstations and an integration farm, and also between either an integration farm or authoring client workstations, and pilot or production farms.


    Create a Feature


    When you create a custom Web page in SharePoint Server 2010 by using the browser or SharePoint Designer, the ASPX page can belong only to the root site collection of the server that is running SharePoint Server 2010. To create a page under a site collection that is available to the whole farm and in all site collections, use a solution to deploy the page under the \14\Template\Layouts folder (by using the TemplateFiles element in the solution manifest file).


    A best practice on a farm is to deploy Features by using a solutions package. If a server must be rebuilt or another server is added to the farm, the Feature will not have to be manually added to each front-end Web server. By using solutions packages, you can deploy new and upgraded Features across the farm and synchronize a front-end Web server so that its state is consistent with the state of other servers in the farm.


    To control the availability of a custom page in a site collection or a Web site, deploy the custom Web page as a SharePoint Feature as part of a solution. Use the module element in the Feature.xml file to deploy a Web page by using a scope of site collection and Web site. Modules are frequently used to implement a Web Part Page in the site.


    To create and deploy a custom Feature

                              1.   Create a Feature.xml file. The following is an example Feature.xml file, which is necessary            for giving the feature a unique ID and pointing to the Module.xml file.

    "Custom Web page"
    Description="This simple example feature adds an ASPX page 
    with a hosted XmlFormView control" 
    Version="1.0.0.0" Scope="Web"
    xmlns="http://schemas.microsoft.com/sharepoint/">
     
     

    Create a Module.xml file. The following is an example Module.xml file, which contains information about the page or pages that are part of the solution.

     
      
     

    2. Change the file url value to the name of your ASPX page.

    3. Add a subfolder for the Feature definition within the Features setup directory on the server computer, typically located at %COMMONPROGRAMFILES%\Microsoft shared\Web server extensions\14\TEMPLATE\FEATURES.

    4. Add your custom .aspx page to this subfolder for the Feature definition.

    5. Add Feature.xml and Module.xml files to the same location.

    6. Add the Feature to a solution package.

    7. You can use Visual Studio 2010 to add the Feature to a solution, or you can manually add a FeatureManifestselement to the solution Manifest.xml file.

    8. Create the solution package.

    You can use Visual Studio 2010 to build the solution package. You can also use the Makecab.exe tool to create the solution package.

    9. Import and deploy the solution package.

    Add the solution to the solution store by using the Windows PowerShell Add-SPSolution cmdlet, and then deploy the solution from the solution store by using the Central Administration Web site or by using Windows PowerShell.


    To Install a Feature by using Windows PowerShell:

                           1.   On the Start menu, click All Programs.

             2. Click Microsoft SharePoint 2010 Products.

             3. Click SharePoint 2010 Management Shell.

             4. At the Windows PowerShell command prompt, type the following command:

             5. Install-SPFeature -path [-force]

             Example: Install-SPFeature FeatureFolderName -url http://server/site/subsite
             Disable-SPFeature FeatureFolderName -Url http://server/site/subsite


    * Features Location: C:/ProgramFiles/CommonFiles/MicrosoftShared/WebServerExtention/14/Template/Features

    * Every Feature will have atleast one file named  Feature.XML Called as Feature Manifest.

    A feature is a set of feature.XML and other elements manifest files. It may also contains CSS, ASPX Files, Images etc..

    * What is the base class of feature? SPFeatureReceiver


    • 2
  • Sudheer Kumar
    Sep, 2014 29

    Want to know how to create features in SharePoint : Refer this http://sharepointsolutions-sudheer.blogspot.in/2014/09/create-features-in-sharepoint.html

    • 1


Most Popular Job Functions


MOST LIKED QUESTIONS