Showing posts with label Feature. Show all posts
Showing posts with label Feature. Show all posts

Wednesday, July 15, 2009

Deploying Solution Package Using STSADM

Now there are different way you can deploy your solution package into sharepoint.If you are looking for WSP Builder Project You can download it from following link http://wspbuilder.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24627 .Its a visual studio extension.

Playing with STSADM for solution deployment
we can use our sweet and dirty comandline tool STSADM.
You can find stsadm.exe in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

Solution Pack Deployment
Step1 : Add the solution pack (Only added solution pack can be deployed)
stsadm -o addsolution -filename
example : stsadm -o addsolution -filename c:\ShyjumohanBlog.wsp

Step2 : Deploy the solution pack
stsadm -o deploysolution -name
example : stsadm -o deploysolution -name ShyjumohanBlog -immediate -allcontenturls -allowgacdeployment -allowcaspolicies
Parameter usage
-immediate - Going deploy it immediately
-allowgacdeployment - WSP pack contains some dll's which should goes to GAC.

If you need to delete a solution pack use the following command

Step1 : Retracts the specified solution’s deployment.

stsadm -o retractsolution -name -immediate -allcontenturls
example : stsadm -o retractsolution -name ShyjumohanBlog -immediate -allcontenturls
The retractsolution operation removes files from the front-end Web server

Step2: Delete the solution
stsadm -o deletesolution -name
example : stsadm -o deletesolution -name ShyjumohanBlog
The deletesolution operation deletes the solution package in the solution store of the configuration, and should only be called after solution packages have been retracted.

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

Create ContentType as a Feature

Some times it will be necessary to deploy contenttype as a feature.If you are new to ContentType then follow my previous POST.

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 ContentType Feature
First step create the desired coloumn as a feature Follw My BlogCreate Site Coloumn As Feature

1. Create a new folder called "SampleBlogContetType" 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="3B4752E6-8D62-4df0-A4D3-31C8E99D44FC" Title="Blog Sample Content Type" xmlns="http://schemas.microsoft.com/sharepoint/" Description="Shyju Mohan's Sample Content Type" version="1.0.0.0" scope="Site" hidden="FALSE">

<ElementManifests>

<ElementManifest Location="elements.xml">

</ElementManifests>

</Feature>



3. Create a new file called elements.xml

<?xml version="1.0" encoding="utf8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType ID ="0x0110035A5E402D9B4EAAC0049A3554D81" Name="BlogPerson"
Version='1' Group="BlogSample"/>
<FieldRefs>
<FieldRef ID ="{95EF4E88-A8AE-4b11-8110-DEE7B2CE4D41}" Name="PersonName"/>
<FieldRef ID ="{95EF4E88-A8AE-4b11-8110-DEE7B2CE4D41}" Name="Age"/>
<FieldRef ID ="{96EF4E88-A8AE-4b11-8110-DEE7B2CE4D41}" Name="Salary"/>
</FieldRefs>
</ContentType>
</Elements>


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 SampleBlogContetType

5.Again in command prompt and type the following:

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

Cheers
Shyju Mohan