Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand

SharePoint 2010 Project – Foster – Part 4

Posted by Jean Paul on July 11, 2012

Dear Friends,

Please find the fourth part of the project named Foster.

In the previous part you have find how to do the Infrastructure setup for the project Foster. In this part we can explore the actual SharePoint implementation of the project.


Note: The attachments contain the SharePoint solutions for the project. You can download the attachment here.

Reference Links

Following are the skills you need to master in order to proceed with the implementation. Some of them tend to be easy but some of them required dedicated effort to get through.

1. Creating Host Name for Web Application

2. Create Site Column

3. Navigations, Logo, Theme & Customizations

4. Starting Programming

5. WebParts Programming

6. LINQ & SPMetal

7. Creating a User in Active Directory & Adding to SharePoint

8. Client Object Model, Date & CAML

I would like to advise you to go through the above links to get a total understanding of the aspects.


Following are the activities involved in the implementation:

1. Creating Web Application

2. Creating Site Collection

3. Creating Sub Sites

4. Create Site Columns

5. Creating Lists

6. Creating Approval Workflow

7. Creating Search WebPart

8. Creating Timer Job

9. Setting Permissions

10. Creating Client Application

Creating the Web Application

For performing this step open the Central Administration and create a new Web Application with:

· Name as Foster

· Port as 80

· Host Header as


Then add the following entry to the hosts file.

Modify the registry to disable loopback check.


Creating the Site Collection

After creating the Web Application you will be prompted with the following dialog:


Click on the Create site Collection link above to create the new site collection for Foster.

In the appearing dialog set the following options:

· Name as Foster

· Description as Foster SharePoint 2010 Application

· Template as Blank

· Primary User Name as Administrator

Leave the other options as default and click the OK button. Wait for a while and you will be prompted with the following dialog:


Click on the above link to access the main site collection. On a successful state you should get:


Now we need to Activate the SharePoint Server Publishing Infrastructure for the above site collection. You can do it from Site Actions > Site Settings > Site collection features link.

Creating the Sub Sites

Now we need to create the sub sites:

· Applications

· Approval

· Search

Choose the Blank Site template for the above as we need to customize them later. For each of the site created modify the Site Actions > Site Settings > Navigation settings as below:


After creating all the sub sites the Home Page view is as following:


Creating the Site Columns

We need to create the Application Status column which is going to be shared across multiple lists in the site. This is the right scenario to use Custom Site Columns.

Create a new Site Column with the following attributes:

· Name as Application Status

· Type as Choice

· Values as Started, Approved, Rejected

· Default Value as Started

After creating the site column you will be able to see it in the Site Columns list.


Creating the Lists

Now we can proceed with creating the Lists. I believe you are aware that there are total of 3 lists of type Applications.

1. New Applications

2. Approved Applications

3. Rejected Applications

This would be the right scenario to use a Custom List Template. We can proceed by creating one list, create a template from it and create the other lists using the template.

For starting with go to the Applications site and chose the Lists > Create option. Enter the list name as New Applications. After creating the list perform the following.

1. Go to List > List Settings > Rename the Title column to First Name

2. Use the Create Column link to create the other columns as per Detailed Design

3. Use the Add from existing columns to add the Application Status site column


Now the list structure should look like:clip_image014

Please remember to mark the required columns as above.

Now we need to create a list template from the above list. Go to List Settings and choose the Save list as template option. Enter the name as Foster Applications for the template.

We are ready to create the other two lists. Go to the Approval site and choose Lists > Create option. From the dialog box select the list template which we created just now. Enter the list name as Approved Applications.


Again repeat the step for Rejected Applications list.

Now we need to create the Employment Status list inside the Approval Site as below:


Creating the Approval Workflow

Open Visual Studio 2010 and create a new project named Foster.Workflows from the template SharePoint 2010 > Workflow. Name the workflow as ApprovalWorkflow.

Choose the site as:

On the Activated event of the workflow enter the code to perform the following:

· Fetch the New Applications list

· Check each item for Maximum Amount

· Check each item with the Employment Status list

· Change the status to Approved or Rejected

· Copy the item to appropriate list

· Delete the item from New Applications list

Note: You should implement this code by yourself and you may use the attachment which contains the workflow source as reference.


Once the workflow is ready choose the Deploy option to get it deployed. After deployment you should be able to see it from the Main Site > Approval Site > Lists > Site Workflows link.

Creating the Search WebPart

The WebPart is needed to provide a user interface for the user to Search applications based on the SSN number.

Open Visual Studio 2010 and create a new project from SharePoint > 2010 > Visual Web Part. Name the project as Foster.WebParts. Choose the solution as Sandboxed and enter our site url.

Design the user interface of the webpart as shown below:


On entering the SSN and clicking the Search button the 2 DataGrid controls should be populated.

Note: You should implement this code by yourself and you may use the attachment which contains the webpart source as reference.

Creating the Timer Job

The Timer Job is needed to populate the Employment Status list from an external database. Create a new SharePoint project and name it as Foster.TimerJobs.

Add a new Entity Data Model for the external database table as shown below:


Create a new class and inherit from SPJobDefinition. Name the class as EmploymentStatusJob. Add a feature to install / uninstall the timer job. On the Execute() method of the timer job copy the entities from external database and update the Foster Employment Status list.

Keep the timer job interval as 5 minutes and deploy to the site collection. You can debug it inside Visual Studio. You might need to restart the OWSTIMER.EXE (SharePoint Timer Service) occasionally.

Note: You should implement this code by yourself and you may use the attachment which contains the timer job source as reference.

Setting the Permissions

Now we are ready to set the permissions. Go to each site and choose Site Actions > Site Permissions. Set the appropriate users for each site.

· Home site is accessible by users Clerk and Manager

· Applications site is accessible by user Clerk

· Approval site is accessible by user Manager

· Search site is accessible by users Clerk and Manager

After doing the above you can test it by clearing the browser cookies and accessing the base url. Try logging in using user as Clerk / Manager.

Creating the Client Application

We need to create a Windows Forms Application to accommodate the Accounting SDK machine access to SharePoint.

Create a new Windows Application and add reference to the following assemblies:

· Microsoft.SharePoint.Client

· Microsoft.SharePoint.Runtime

Modify the front page of the main form as following:


On clicking the Connect button the Client Context has to be created based on the url specified in application configuration file.

The second button should perform getting the total of Amount allocated for current month. You can use CAML to achieve this.

The third button should act as a dummy posting to the Accounting SDK which falls in the outer boundaries of our application.

Note: You should implement this code by yourself and you may use the attachment which contains the client source as reference.


Following are the project contained inside the attachment:

1. Foster.WebParts

2. Foster.Workflows

3. Foster.TimerJobs

4. Foster.ClientApplication

You can download the attachment here.


This concludes the implementation part of Foster. I hope you enjoyed it and were able to complete the implementation. The attachments contain the solutions we have discussed. For any further clarifications you can contact me.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s