Saturday, January 10, 2009

Site templates not available in SharePoint Publishing Site

Many of us would have seen this question in communities. When you create a sub-site from publishing root site, by default the site template list will show “Publishing site with workflow” template.

It doesn’t mean that you can create only publishing site within a publishing root site. To add other site templates, navigate to Site Actions --> Site Settings --> Modify All Site Settings. Click on “Page layouts and site templates” from “Look and Feel” section.

Add whatever site templates you are interested in to create sub-sites from publishing site. I have added a “Blog” template.

Now navigate to Site Actions --> Site Settings --> Create Site, notice that the newly added site template is available for you.

Hope this will be helpful to someone.

Friday, January 2, 2009

Programmatically adding web part to a SharePoint page from web part gallery

I had a requirement to add a web part to default.aspx page from Web part gallery. I have used a Feature to do the same. Please find the code below which is written in “Feature Activated” event.

Feature Activated

Add WebPart

Get WebPart XML

Hope the code is straightforward to understand.

Thursday, January 1, 2009

SharePoint Feature to add site columns

This post explains adding new site column to a SharePoint site. The following simple steps needs to be done to add site columns to a site collection.

1) Identify the Fields (Site Columns), type and its properties. Each Field will have properties like ID(GUID), Display Name, Required, etc.

2) Create a XML file for adding the column information. Ex. “SiteColumns.xml” - This file holds the metadata information related to site columns (Fields). This file information used in
<ElementManifests> section of FEATURE.xml.

3) Create a FEATURE to add these site columns to a site collection.
See the following sample screens to get the better understanding


<Elements xmlns="">
<Field Type="HTML"
Group="Custom Column"
Name="About" />

<Field Type="Image"
Group="Custom Column"
Name="AboutImage" />


<Feature Id="873CDC1A-D801-11DD-B399-959255D89593"
Title="Add Site Columns Feature"
Description="This Feature adds Site Columns"
<ElementManifest Location="SiteColumns.xml"/>

This post will also be helpful for the newbie’s to understand about Feature in SharePoint.