Showing posts with label Site Coloumn. Show all posts
Showing posts with label Site Coloumn. Show all posts

Saturday, July 4, 2009

How to Create Site Coloumn- MOSS 2007

When we are developing sharepoint application its quiet common that we need to add site coloumns.So we can create our own cloumn for a share point list or document library or Content Type.Following steps will show how to create a site coloumn
Step 1. Goto to your sharepoint site and click on the site action menu (top right side)

Step 2.Click on the Site Setting Sub Menu.

Step 3.In Site settings page Go to Gallery Section and Click on Site Coloumn Link


Step 4.In Site Coloumn Gallary page you can see all the existing site coloumns.Next you have to click on the creat link in site coloumn gallery page.


Step 5.In site coloumn Create page specify the coloumn name you want to create


Step 6.Specify the type of Coloumn we are going to create.Here we are going to create a lookup coloumn.


Step 7.Specify the group under which this new site coloumn should go.You can add new group so it will help to identify the our coloumn.Give a meaning full busines group name or project name.


Step 8.Specify this will be a required coloumn.(suppose we added this coloumn into a list and saying this is required coloumn)



Step 9.Now we are going to specify our source list for theis lookup coloumn.Specify a list from the drop down.Look at my BlogHow to create list.


Step 10.Next we are going to specify which will be the coloumn in the source list being use as the source coloumn for this lookup coloumn.


Step 11.Specify this lookup coloumn supports mutiple value from the source coloumn.


Step 12.After sucessfull you will see the following screen, in which you can see the new cloumn created under a new group we specified.


Cheers
Shyju Mohan

Friday, July 3, 2009

Site Coloumn As Feature


How To Create a Feature
As a first step you you have to add a subfolder containing a Feature definition(Feature.xml) within the Features setup directory (Local_Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES). Feature.xml file defines the base properties of the Feature and lists elements bound to it. The Feature element is used in a Feature.xml file to define a Feature and to specify the location of assemblies, files, dependencies, or properties that support the Feature

Create a Site Coloumn Feature
1. Create a new folder called "SampleBlogColoumn" under C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Features\.

2.Create a new file called features.xml containing:


<Feature Id="F5E3FEE8-1D9B-4b95-848B-7614D638B90D" Title="Sample Bloge Site Columns" xmlns="http://schemas.microsoft.com/sharepoint/" Description="Shyju mohan's Sample Site Columns" version="1.0.0.0" scope="Site" hidden="FALSE">

<ElementManifests>

<ElementManifest Location="elements.xml">

</ElementManifests>

</Feature>




This feature.xml will describe about our new site column feature.This file should be placed in the folder created in previous step.

3. Create a new file called elements.xml

<?xml version="1.0" encoding="utf8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Field ID ={94EF4E88-A8AE-4b11-8110-DEE7B2CE4D41} Name="PersonName"
SourceID="{9c8a1ac8-fe75-4d7d-87af-e1de3e1b82e6}" StaticName="PersonName" Group="BlogSample"
Type="Text" DisplayName="Person Name"/>
<Field ID ={95EF4E88-A8AE-4b11-8110-DEE7B2CE4D41} Name="Age"
SourceID="{9c8a1ac8-fe75-4d7d-87af-e1de3e1b82e6}" StaticName="Age" Group="BlogSample"
Type="Text" DisplayName="Age"/>
<Field ID ={96EF4E88-A8AE-4b11-8110-DEE7B2CE4D41} Name="Salary"
SourceID="{9c8a1ac8-fe75-4d7d-87af-e1de3e1b82e6}" StaticName="Salary" Group="BlogSample"
Type="Number" DisplayName="Salary"/>
</Elements>

This element.xml will describe each coloumn in our feature.This file should be placed in the folder created in previous step.Now we are ready to deploy our feature.Assumes already know about the tool STSADM (Exe tool runs from the command propmpt).We can use stsadm to deploy our feature

4. Open a command prompt and type the following:

CD C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin

stsadm -o installfeature -file SampleBlogColoumn

Above command will install the feature.Next step is to activate the feature so we can go for command prompt again or sharepoint central administration site to activate the feature.

5.Again in command prompt and type the following:

stsadm -o activatefeature -file SampleBlogColoumn -url http://localhost/

Further Reading Content Type as Feature

Cheers
Shyju Mohan