July 2009


Introduction to Workflows

Microsoft Windows SharePoint Services provides a robust, customizable work environment for users to create, collaborate, and store valuable business information. Now, with Microsoft Windows SharePoint Services 3.0 and Microsoft Office SharePoint Server 2007, you can attach custom business processes to these documents or list items.

You can represent these custom business processes by using workflows. A workflow is a natural way to organize and run a set of work units, or activities, to form an executable representation of a work process. This process can control almost any aspect of an item in Windows SharePoint Services, including the life cycle of that item. The workflow is flexible enough to model both the system functions and the human actions necessary for the workflow to complete.

You can create workflows that are as simple or complex as your business processes require. You can create workflows that the user initiates, or workflows that Windows SharePoint Services automatically initiates based on some event, such as when an item is created or changed.

Suppose you need to create a simple workflow that routes a document to a series of users for approval or comments. This workflow would include actions that the system needs to perform, as well as provide interfaces for the users to interact with the workflow in prescribed ways. For example, Windows SharePoint Services would send an e-mail message to the selected users when the document was ready for review. Those users would then need to be able to notify Windows SharePoint Services when they had completed their reviews and, optionally, enter any comments. The workflow framework included in Windows SharePoint Services 3.0, and extended in SharePoint Server 2007, enables you to model such complex work processes and present them to end users in an easily understood, unobtrusive manner that guides them through each step of the process.

Windows Workflow Foundation supports two fundamental workflow styles:

  • Sequential workflows Represents a workflow as a procession of steps that execute in order until the last activity completes. However, sequential workflows are not purely sequential in their execution. Because they can receive external events and include parallel logic flows, the exact order of activity execution can vary.

  • State machine workflows Represents a set of states, transitions, and actions. One state is denoted as the start state, and then, based on an event, a transition can be made to another state. The state machine can have a final state that determines the end of the workflow.

You can create workflows of either type for Windows SharePoint Services and SharePoint Server.

Sequential Workflows

Sequential workflows can best be represented graphically as a flowchart of actions, with a beginning, an end, and a sequential flow direction from start to finish. Sequential workflows can incorporate flow structures such as repetition, looping, and parallel branches, but ultimately progress from the initial action to the final action.

For example, suppose you were to chart the simple workflow that routes a document in Windows SharePoint Services for approval. When the workflow starts, the system notifies the specified reviewer, by e-mail message, that he or she has a document to review. The reviewer then reviews the document and notifies the system that the task is completed and whether the reviewer approves or rejects the document. Based on the reviewer response, the workflow executes one of two parallel branches. If the reviewer approved the document, the system moves the approved document to a specific SharePoint document library and then sends an e-mail message to the entire team notifying them of the approved document. If the reviewer rejects the document, the system notifies the document author. In either case, the workflow then reaches its end and terminates. Figure 2 shows this workflow.

Figure 2. Conceptual diagram of a sequential workflow

Diagram of a sequential workflow

State Machine Workflows

Unlike sequential workflows, state machine workflows do not have a prescribed execution flow, and need not have an end. Instead, state machine workflows define any number of states which an item may inhabit, and the events that transition the item from one state to another.

Figure 3 represents a simple document publishing process, modeled as a state machine workflow. The workflow is initiated when a document is created, and ends when the document state is set as completed. In between, however, the document does not travel in a predetermined path, but instead transitions from state to state as events occur.

The state machine workflow is composed of state activities. Each state activity represents a state for the item. Each state activity can contain optional state initialization, state finalization, and one or more event handlers. Each event handler activity can handle one event. In response to the event handled, some processing can be done, and a transition can be made to another state.

Figure 3. Conceptual diagram of a state machine workflow

Diagram of a state machine workflow

One characteristic of both sequential and state machine workflows is that each type of workflow can be broken into a collection of discrete actions—those performed by the system, and those taken by users. You can consider these actions to be the building blocks of workflows. In WF workflows, these actions are referred to as activities.

if it is helpful, plese dont forget to leave a comment.

Procedures

Step 1: Start Server Manager

To start Server Manager, click: Start Menu -> All Programs -> Administrative Tools -> Server Manager. The Server Manager window opens.

1
Figure 2: Server Manager

Step 2: Adding a Server Role

  • In the Server Manager, select Roles.
  • The Role Summary View is displayed.

2
Figure 3: Start Add Roles Wizard

Step 3: Start the Add Roles Wizard

  • Click Add Roles.
  • The Add Roles Wizard opens.
  • Click Next to select roles to install.

3
Figure 4: Add Roles Wizard Introduction

Step 4: Choose Web Server (IIS) Role to Install

  • Check Web Server (IIS).

4
Figure 5: Check Web Server (IIS) in Add Roles Wizard

Step 5: Web Server Role depends on WAS

The Add Roles Wizard notifies you on any required dependencies; since IIS depends on the Windows Process Activation Service (WAS) feature, the following informational dialog displays.

  • Click Add Required Role Services to continue.

5

Figure 6: Add Dependencies

Web Server is now selected for install. The Select Server Roles dialog box opens.

6

Figure 7: Selected Web Server (IIS)

  • Click Next to continue.

Step 6: Additional Information

The following dialog box and information displays.

7

Figure 8: Introduction to Web Server Dialog

  • Click Next to continue

Step 7: View IIS 7.0 Features

The Add Roles Wizard displays a list of all IIS 7.0 features available to install as shown below. Note that features comprising the default install are pre- selected.

8

Figure 9: Web Server Features Listed

Note: To install just the IIS 7.0 default features, click the Install button and then proceed to Step 10 below. If you need to install additional features, proceed to Step 8.

Step 8: Select Additional IIS Features to Install

For this example, we install additional IIS features:

  • Start by checking the box for ASP.NET. The following dialog displays.
  • The Wizards warns if adding an IIS feature will also cause other features to be installed.

9

Figure 10: Dependency Information

  • Click Add Required Role Services to continue.

Step 9: Select Additional IIS Features to Install

Continue selecting additional IIS Role Services features to Install:

  • Check the features you require.

10

Figure 11: Add Features For Web Server

  • When you have selected all the features you require, click Next to continue.

Step 10: Summary of Features to Install

  • The Wizard provides a summary of what will be installed, as shown below

11

Figure 12: Summary of Features

  • Click Install to continue.

Step 11: Install Progress

After clicking Install, the install progress dialog opens.

12

Figure 13: Install Progress

Step 12: Install Complete

When IIS 7.0 install is complete, the following dialog opens. Click Close to return to the Server Manager.

13

Figure 14: Installation Summary

Step 13: Check IIS 7.0 install

You can now perform a quick check to verify that IIS 7.0 is installed.

  • Start Internet Explorer web browser and enter the address http://localhost.
  • You should see the default IIS “Welcome” page.

if it is helpful, plese dont forget to leave a comment.

You have already seen Web part verb if you have worked with web parts. They appear when you press the down arrow button key available in every web part at right hand side corner. Each item in that menu is called verb. Look in to below image.

1

As you can also see in the image that we have created our own custom web part verb as well and added to the web part.

So let us start with explaining the method how we can achieve this functionality. First you need to know that there are two kinds of event you can bind it to a verb. Either it can be client side event or it can be server side event. As you can see in the image, to show you I have created two verbs and bound events respectively. You need to overrides WebPartVerbCollection. First you need to create your web part verb and then finally we will add them to the default web part verb collections for the web part.

Let us see it in action.

First web part verb will be handling the server side event and the other web part verb will be handling the client side event.

public override WebPartVerbCollection Verbs
{

get
{
List <webpartverb> objVerbs = new List <webpartverb>();

WebPartVerb verb = new WebPartVerb(this.ID, new WebPartEventHandler(ServerSideHandler));
verb.Text = “Click to execute server side code”;
verb.Visible = true;
verb.Description = “This click will execute server side code”;
objVerbs.Add(verb);

WebPartVerb verb1 = new WebPartVerb(this.ID + “newone”,”alert(‘hi you clicked me!!!’);”);
verb1.Text = “Click to execute client side code”;
verb1.Visible = true;
verb1.Description = “This click will execute client side code”;
objVerbs.Add(verb1);

WebPartVerbCollection allverbs = new WebPartVerbCollection(base.Verbs,objVerbs);

return allverbs;

}
}

As you can see, client side event, we have declared it in the constructor of webpart verb itself. There you can also write something like window.open or any other client side code that you want.

If we talk about the server side code, then it is handling one webpart event ahndler which is ServerSideHandler. To show you how it works, I have created a textbox in that event and added to the controls collection of web part. So by clicking on that verb, a new textbox will generated and added to the webpart.

public void ServerSideHandler(object sender, WebPartEventArgs e)
{
TextBox txtName = new TextBox();
txtName.TextMode = TextBoxMode.MultiLine;
txtName.ID = “txtname”;
txtName.Text = “Hey you clicked server side code and see i got generated here”;
this.Controls.Add(txtName);

}

Above are the steps that you need to implement. That will complete your functionality of achieving custom web part verb and adding them to your web part.

See the figure below when I click on client side verb, what happens!!

And see when I clicked on server side web part verb, what happenes!!


2

3

4

5

So I hope that now you have got the idea about web part verb. So now you can create it and use them according to your requirements.

Thank you.

if it is helpful, plese dont forget to leave a comment.

I have found a good collection of Custom Action Location and ids from MSDN

click here

if it is helpful, plese dont forget to leave a comment.