Adding a Custom Web Part to a Site Definition

28 11 2008

I had to do this today and having looked around on the internet finding lots of conflicting examples, I thought I’d post the code that I used on here.

Basically what you need to do, is open the ONET.xml for your Site Definition.

Inside the ONET.xml file you will find a section called <Modules>, inside here should be a default module of some kind: <Module Name=”Default” Url=”” Path=””>.

It is inside here that you need to add the web part, to add a custom web part use the code below:

<AllUsersWebPart WebPartZoneID=”Left” WebPartOrder=”1″><![CDATA[
    <WebPart xmlns=”″ >
    <Title>’Title of Your Web Part’</Title>
    <Description>’Description For Your Web Part’</Description>
    <Assembly>Full Assembly (DLL) Details</Assembly>

Ensure that you put the full Assembly details in the <Assembly> Tag and the Class Name inside the <TypeName> Tag.

Perform an IISRESET and your done!

Footnote: You will only see the Web Part on new sites that you create and not existing ones.

WSS (Windows SharePoint Services) Workflow with ASPX Task Forms Tutorial – Part 1

26 11 2008

Dear readers,

This is one of the areas I really struggled in when I moved from creating SharePoint & InfoPath form based workflows to creating WSS workflows that use ASPX pages for task forms.

Because WSS does not include ‘Forms Services’, the technology which allows the use of InfoPath forms in a web browser, the only real solution is to create some aspx pages to use for the task forms.

While looking round on the net, I noticed there was a lack of any workflow tutorials for WSS so I have decided to create a four part tutorial. In this tutorial in we will create a simple workflow allowing us to explore the steps required to develop workflows for the WSS platform.

In Part 1 of the tutorial we will look at a simple workflow process and will set up our Visual Studio project and batch file. In Parts 2 and 3 we will code the solution and in Part 4 we will deploy the solution to WSS.

Before we start I’d like to point out some of the annoyances I have encountered with ASPX based workflows:

  • You cannot visually design the ASPX pages if you inherit from the SharePoint default and application.master pages, the best way to get around this is to design the pages in a separate Visual Studio project and then copy the code over.
  • Any task that contains different fields/metadata will need its own Content Type, this means if you have a large workflow you will have many Content Types.
  • When you create a task using a ‘CreatetaskwithContentType’ activity it does not associate the Content Type to the Task list for you, you will need to run some code before the activity to add the Content Type at runtime.

Other than the above, I cannot find much more to complain about :p.

So, let’s imagine that we need to create a workflow to mimic the process below:


As you can see this is a fairly simple approval process, we can add a number of log activities throughout the workflow to enhance it further.

As you probably already know, there are two types of SharePoint/WSS Workflow – Sequential or State Machine.

  • Sequential – These are workflows that progress in a flowchart style nature and cannot go back in the process.
  • State Machine – These workflows progress from ‘State’ to ‘State’ and can go back at anytime in workflow. There is greater flexibility.

We will use State Machine for this tutorial as when the item is rejected, we need to go back to the previous task. We now need to configure Visual Studio, I will use Visual Studio 2008 for this tutorial, however you can use 2005 if needed.

Begin by creating a blank C# State Machine Library Project in Visual Studio:


Configure the solution explorer like the below example by adding the relevant folders, this will help us when we come to deploy our workflow to WSS.

In addition rename the Worklow1 class to something more meaningful and strongly sign the assembly to create an .snk file by using the Project > Signing dialog box.


We will use the Features directory to store the feature files, Images for any custom images we might add and the Layouts to store our ASPX forms.

This is the end of Part 1, stay tuned for Part 2 within the next few days!!

Creating a Search Centre

13 11 2008

I am currently looking into the enterprise side of MOSS and thought I would begin with creating a search centre for our site collection.

A search centre is essentially another site collection that provides the users with an area to perform advanced searches across site collections.

I was surprised at how easy this was to setup, if you want to create a search centre. Simply choose to create a new SharePoint site within the site collection and select the ‘Search Centre’ template. Once you click ‘create’ the search centre will be setup and you will be taken straight there.


I will post back as I start to configure search scopes etc!

Guitar Hero 4 – World Tour (I Want!)

10 11 2008

Thought I would blog about the latest in the Guitar Hero Franchise. The latest offering from the folks at Neversoft allows you to create your own Characters, write your own music and rock out to 86 songs! With the band version you get:

  • Guitar
  • Bass Guitar
  • Drums
  • Microphone

I’m hopefully going to ask for it for Christmas so will report back on what its like 😀