Monday, September 21, 2009

Site Definitions and Site Templates - More differences

Both Site Templates and Site Definitions can be used to create new site collection(s)/site(s). They can be understood as

Site Definition: Site definition is stored on the SharePoint Web Front End Server’s file system in the 12 Hive folder. It consists of files like onet.xml, default.aspx, resources files etc.

Site Template: Site Templates are stored in the database (accessible as *.stp file from site templates gallery through front end) and are created by using an existing site, with or with out its specific content as a model.

The following are the differences between Site definitions and Site templates.














 DescriptionSite TemplateSite Definition
1.StorageDatabase12 Hive
2.Easy to createYesNo
3.Needs server access to installNoYes
4.Available for publishing sites(when Office SharePoint Server Publishing Feature is activated)NoYes
5.Provisioning Event Availble (to execute code)NoYes
6.Can be changed after sites are created (Resource files can be changed)YesNo
7.Create new content types (MS Best practice)NoYes
8.Activate Feature during creationNoYes
9.PerformanceLowHigh
10.High level of customization (introducing new file types, view styles, Modifying edit menu etc)NoYes
11.Sites/site collections refer to these files from the central location and hence when changed later at the central location will be reflected in all sites/site collectionsNoneResource Files (Master pages, layout pages, css and javascript files)
12.Can be restricted for availability to a specific web appNoYes

Thursday, February 21, 2008

Important Topics in Learning Sharepoint

01. Introducing MOSS Server
02. Structure and Hierarchy of Sites
03. Customizing sites: Look and Feel, Navigation etc
04. WSS V3 Object Model Fundamentals
05. Developing Features
06. Events
07. Developing custom webparts
08. Site definitions
09. Workflow
10. Authentication and Authorization

Explaining with real world scenarious, Labs and a project.

Wednesday, August 15, 2007

Feature: Adding custom navigation item to Site Actions menu

The code/configuration of Features is present in the 12 Hive folder of the Web server that hosts sharepoint. To be precise, all the features are present in 12Hive\Template\Features folder of the web server.

The following are the major steps in creating a simple custom feature

1. Create a folder for the custom feature in 12Hive\Template\Features with the name of the feature
2. Create a feature.xml with the properties of feature like Id, Title, Description, Scope, Hidden and Location of ElementManifest defined in it.
3. Create a xml file that defines the ElementManifest (details like GroupID, Location, Action etc)
4. Register this feature in the Sharepoint database by using the STSADM command.

On following the above steps, a feature is successfully installed into Sharepoint and will be ready to use by the users.

Let's develop a simple feature with the steps below.

Feature purpose: To add a new menu item to the "Site Actions" drop down, that directly navigates to the "Manage Features" screen of the site.

Steps to create the Feature:

Step 1. Create a folder named "ManageFeaturesShortcut" in 12Hive\Template\Features folder of the web server.

Step 2. Create a file named "feature.xml" in the folder created in step 1., with the following contents:


<feature id="99793569-E6F7-4aca-A809-59E750320351" title="Manage Features" xmlns="http://schemas.microsoft.com/sharepoint/" description="Manage Features of this site" scope="Web" hidden="false">
<elementmanifests>
<elementmanifest location="elements.xml">
</elementmanifests>
</feature>



Step 3. Create a file named "elements.xml" in the same folder as feature.xml, with the following contents:


<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="SiteActionsToolbar"
GroupId="SiteActions"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="100"
Title="Manage Features"
Description="Manage Features of this site">
<UrlAction Url="_layouts/ManageFeatures.aspx"/>
</CustomAction>
</Elements>



Step 4. Run the below STSADM command to install the feature and run IISRESET to start using the feature.



@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm.exe"



%STSADM% -o installfeature -filename ManageFeaturesShortcut\feature.xml -force


IISRESET


ECHO Finished


PAUSE


Friday, August 10, 2007

Sharepoint Development Environment

As developers, we want the development environment to facilitate us to write code, compile and debug code and all these our local PC.

Development environment is relatively straight forward to setup for client-server (windows) apps. So, we got used to do all the above mentioned facilities in an easy fashion through the Visual Studio IDE.

Things started changing with the web applications (browser based). We know it is difficult to setup debugging for ASP/ASP.Net applications due to the complexity of having COM/.Net code running on the server and JS code running on the client.

Recall that when we are doing the Sharepoint development, we are not building an application (using a programming language), but are modifying/working with a Microsoft Product which can be WSS/MOSS. So, difficulty can be expected to write a code that sits somewhere in that product and work seamlessly with it.

So with Sharepoint, the picture changed much more. The developers are expected to sit on a Windows 2K3 Server OS with MOSS/WSS, Visual Studio and atleast a SQL server express edition installed all on the developers machine.

The reason being, when we are doing sharepoint development in the Visual studio, we need to add reference to the WSS object model which is in Microsoft.Sharepoint.dll. This dll comes only with WSS. So, WSS has to be there on the machine that has visual studio. WSS can only be installed on a server OS. So, all these requirements.

Since there are lot of softwares to be setup, development environment creation/maintenance can be simplified by using Virtual PC (Virtual PC contains the server OS, visual studio, WSS etc) while the developer desktop can be a normal OS desktop.

More info about development can also be had at

http://msdn2.microsoft.com/en-us/library/bb330848.aspx

http://dotnetaddict.dotnetdevelopersjournal.com/sharepoint_dev_environment.htm

Adding Webparts to pages

Adding/Customizing/removing webparts to sharepoint pages is one of the most attractive feature of sharepoint.

Webparts can be added to a sharepoint page by going to "Site Actions ==> Edit page ==> Add a Web part".

If you do not see the webpart in the above list try the following.

1. Go to the top level site of the site collection.
2. Go to "Site Actions ==> Site Settings ==> Modify all site settings ==> Galleries ==> Web parts".
3. In the web part gallery, click on the "New" option in the top left corner page menu and populate the gallery with the required web parts.

Be also aware of the version of your sharepoint (WSS or MOSS and their version number) installation and with which version does the webpart is installed through sharepoint.

Monday, August 6, 2007

Understanding Site Definition and a Site Template

A Site Definition is a component in sharepoint, that is used to provision sites. This component defines what further components a site contains, when it is created out of this site definition. These further components can be pages, web parts in pages, document libraries etc.

The Site definition consists of atleast one file named ONET.xml and any further set of files, basing on requirement. These files are stored in 12 HIVE of the web server file system at "12-Hive\Template\SiteTemplates". When the user is trying to create a new site, all the existing and accessible site definitions are provided to him, from which he can choose a one of his choice.

Once a site has been created out of a Site Definition, there is a permanent reference to the site definition from the site and this can not be removed. So, as along as the site needs to be functional, the site definition needs to be present in the sharepoint.

For creating a custom site definition, involvement of a developer is required to create the files like ONET.xml and ship them to the web server. From the end user point of view, sharepoint gave those users a similar facility called Site Template. A Site Template can be created out of a sharepoint site and that Site Template can be used to create similar sites using that Site Template.

We have to take a note that Site Templates is only available for team sites in Sharepoint and a Site Template can be created for any team site in the following steps.

1. Browse to any team site for which you would like to create a Site Template of.
2. Go to "Site Actions ==> Site Settings ==> Modify All Site Settings ==> Save As Template".
3. This option would allow us to create a .STP file for this site. So, create a file named Temp.stp.
4. Now, when we try to create a new site, along with the list of other site templates, we also get the option to choose the newly created site template Temp.stp and so choosing this will create a site out of this Site Template. The .STP file is stored in the "Site Templates" gallery of the site collection and is available for creating sites in that site collection.

This explains the broad differences we have between a Site Definition and a Site Template.

Saturday, August 4, 2007

Customizing Navigation: Moving Top Nav to the Quick Launch Area

The Top Nav is defined in the master page. The top level design of master page has 4 HTML table rows. By default, Top Nav is present in the3rd row and Quick launch in the 4th.

Just cut the Top Nav control

=================================
<asp:contentplaceholder id="PlaceHolderHorizontalNav" runat="server">
-----------
</asp:contentplaceholder>
=================================

from the 3rd row and put it in the 4th row along with the quick launch which is

=================================
<asp:contentplaceholder id="PlaceHolderLeftNavBarDataSource" runat="server">
.......................
</asp:contentplaceholder>
=================================

You can either remove the quick launch control if you don't need or hideit (with HTML attributes).

Change the value of Orientation from Horizontal to Vertical for 'SharePoint:AspMenu
ID="TopNavigationMenu"'.