Friday, October 5, 2007

MOSS 2007 Features

Features are another important new feature in MOSS 2007. They are easy way to deploy changes to a SharePoint environment. You can deploy site columns, content types, assemblies, web parts, menu items, workflow, and events to new and existing Office SharePoint Server 2007 sites. The Feature framework has been extended to allow developers to create custom Features.

“An example is a set of lists and libraries combined with workflow and custom navigation that contain the functionality required to enable a certain business process to function with SharePoint”. Features make it possible to activate or deactivate functionality in the course of deployment.

Features are deployed as files on the server. They can be found in the “Features” folder, which is a sub folder of the “Template” folder.

As noted in the SDK, Features provide the following capabilities.

1)Scoping semantics for determining where custom code is runs.
2)Plugging behaviour for installing or uninstalling Features within a deployment.
3)Plugging behaviour for activating or deactivating Features at a given scope.
4)A scoped property bag for storing data required by Features within its scope.
5)The basis of a unified framework for distributed deployment of WSS 3.0 solutions.

Both developers and administrators will benefit from using Features throughout a SharePoint Server 2007 deployment. Through Features schemas, developers can scope and add simple changes, such as provisioning new pages to SharePoint site, or registering and deploying complex solutions developed in Microsoft Visual Studio 2005, such as event handlers or workflows. Developers can also work with the SharePoint object model which includes Feature classes to effect changes throughout the life cycle of Features.

Feature Implementation

1)A Feature is implemented by adding a subfolder containing a Feature
definition file in “TEMPLATE/FEATURES”.
2)Each Feature subfolder must include a Feature.xml file that defines the
base properties of Feature and lists the element manifests associated with it.
3)After creating the Feature folder, you can install, activate, deactivate
and uninstall the Feature using the stsadm.exe command-line tool or through
the object model.
4)Features can also be activated and deactivated through the user Interface.

When you install a Feature you make its definition know to all front-end web servers across the entire server farm, meaning the area to which the Feature is scoped now display the Feature in its list of available Features to activate. When you activate a Feature, you make it available at the scope defined within the Feature definition.

Implementing Feature Events:

We can use Feature events to manage a Feature life cycle by triggering events during Feature activation and Feature deactivation. Through the Feature events we can manage the Feature lifecycle by choosing to have certain events occur through each stage of Feature deployment, such as when one of the following actions are attempted for a Feature.

1) Installed
2) Activated
3) Deactivated
4) Uninstalled

We can accomplish all of these tasks using Feature Event provisioning callouts derive from the Microsoft.SharePoint.SPFeatureReceiver class.

In my next post I will discuss more about MOSS 2007 Features and I will explain how to create Features in Visual Studio 2005.

No comments: