December 17, 2009

Features in Sharepoint and their creation

Posted in Sharepoint at 5:53 pm by tweaksharepoint

Features provide a mechanism for defining site elements and adding them to a target site or site collection through a process known as “Feature Activation”.

The element types that can be defined by a feature include menu commands, link commands, page templates, page instances, list definitions, list instances, event handlers, and workflows.

At a physical level, Feature has a directory within filesystem of each front-end web server.

The directory has one or more xml files that contain CAML and a manifest file named feature.xml that defines high level attributes of feature(ID, Title..)and additional xml files (elements.xml) that contain actual elements that make up a feature and other file types/resources like css, js, graphics.

With Moss, there will be more than 100 default Features.

To create a hello world feature.. which is a very popular way to begin composing features….:

go to
c:\program files\common files\ microsoft shared\web server extensions\12\template\features

create a visual studio project and make a folder “heallo world” or create a new folder in Features directory and create the below xml files in it.

feature.xml
Id= ” … a new guid” /* run guidgen.exe*/
Title=”Hello World Feature”
Description= “This is my very first custom feature”
Scope=’web”
Hidden=”False”
ImageUrl=”menuprofile.gif”
xmlns = “http://schemes.microsoft.com/sharepoint/”>

Element Manifest file:elements.xml

Id=”SiteActionsToolbar”
GroupId=”SiteActions”
Location=”Microsoft.Sharepoint.StandardMenu”
Sequence=”100″
Title=”Hello world”
Description=”A custom menu item added using a feature”
ImageUrl=”_layouts/images/menuprofile.gif”/>

go to command prompt and then to the folder Features

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES>

and execute this command
..\..\BIN\STSADM.exe -o InstallFeature -filename Helloworld\feature.xml -force
or
%STSADM% -o InstallFeature -filename helloworld\feature.xml -force

and reset the IIS
at command prompt: IISRESET

Once the feature has been properly installed, it can be activated within the context of the site,

site settings–> site features–> shows list of features .
click “Activate” for Helloworld feature.

check the site Actions menu, a new CustomAction element called “hello world ” is added to it.

Reference: “Inside Microsoft Windows Sharepoint Services 3.0” -Ted Pattson, Daniel Larson, Microsoft Press

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: