Monday, March 12, 2012

Solution / Feature Scopes in SharePoint 2010


A feature should be reusable component which can be activated anywhere once deployed .The feature definition has two interesting attributes: Scope and Hidden.

Scope can be Web, Site, Web Application or Farm. It explains why a given feature is visible in the site settings page for a site, a site collection or in central admin .Hidden can be True or False. Only when the value is True is the feature visible in any admin screen.

If we really want to keep things from being exposed to others(Site Owners),  will most likely need to deploy these features as hidden features and then activate them from the command line for the people who need them.

i.e. Hide it and use powershell or stsadm script to deploy.

Sample Ex:

Feature.xml

          Title="Widget Data Site Columns"
          Description="Installs columns designed to manage information about widgets."
Hidden=”True”          Version="12.0.0.0"
          Hidden=”FALSE”
          Scope="Site"
          DefaultResourceFile="core"
          xmlns="http://schemas.microsoft.com/sharepoint/">
   
       
   


The Hidden attribute setting specifies whether the Feature is visible in the list of Features on the Site Features web page. Here, the attribute is set to TRUE which makes the Feature visible to users who want to activate it.

SharePoint Element Types for Features:
The following table describes various element types for Features and shows their possible settings for scope.
Element
Description
Scope
Content Type
Contains a schema definition you can reuse and apply to multiple list definitions.
Site
Content Type Binding
Content type binding enables you to provision a content type on a list defined in the Onet.xml schema. Lists defined in the Onet.xml schema cannot be modified directly.
Site
Control
A delegate control contains a registration for a well-known control installed on a Web page. This lets you replace existing controls, such as the Windows SharePoint Services search control, with another control.
Farm
Web
Application,
 Site 
Web
Custom Action
You can define the following kinds of custom actions:
·         Content type links for the content type settings page
·         Drop-down menu actions for the drop-down menu that appears for an item
·         Form toolbar buttons for New, Edit, or Display form toolbars.
·         Site Settings link for the Site Settings page.
Farm,  
Web
Application,  
Site 
Web
Custom Action Group
Defines a group of custom actions.
Farm,  
Web
Application,
 Site,
 Web
Document Converter
Contains the definition of a document converter. A document converter is a custom executable file that takes a document of one file type, and generates a copy of that file in another file type.
Web
Application
Feature/Site Template Association
Binds a Feature to a site definition configuration so that created sites are provisioned with the Feature.
Farm
Web
Application
 Site
Field
Contains a field definition that can be reused among multiple lists.
Site
Hide Custom Action
Hides a custom action that has been added through another custom action.
Farm
Web
Application,  
Site,
 Web
List Instance
Provisions a SharePoint site with a specific list of data.
Site,
 Web
List Template
Contains a list definition or template, which defines a list that can be provisioned in a SharePoint site.
Site,
 Web
Module
Contains a set of files with which to provision sites.
Site,
 Web
Receiver
Contains an item event receiver registration.
Web
Workflow
Contains the definition for a workflow in a list.
Site


Note: A feature should be reusable component which can be activated anywhere once deployed. We cannot control the visibility of web/site scoped features to single web application. They will be either visible in all of them or none. And a solution can be deployed to particular web application. However, a feature is always deployed globally and then can be selectively activated on multiple web/site/web app/farm depending on scope.


Alternatively In  SharePoint 2010, we have a choice to deploy a solution strictly to single site collection which does not affect other site collections in the same web application or in other site collections in other web applications. These are called "Sandboxed Solutions".

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.