Click here to Skip to main content
15,867,686 members
Articles / Web Development / ASP.NET
Article

SharePoint Workflow Wizard in Visual Studio 2008

Rate me:
Please Sign up or sign in to vote.
3.38/5 (10 votes)
15 May 2008CPOL3 min read 134.1K   42   21
SharePoint Workflows Wizard in Visual Studio 2008

Introduction

Visual Studio tools for office 2008 provides variety of workflow templates. Ofcourse, these workflow templates are based on Windows Workflow foundation (WF) . Continuing the efforts of integrating the other technologies usage and making the Visual Studio as a single UI IDE for developing various components of different technology, Microsoft have came up with few workflow templates specific for SharePoint in Visual Studio tools for office. This article will give you sneak preview about the sharepoint workflows and also provide details on why should we use the sharepoint workflow templates of Visual studio 2008. Visual Studio 2008 provides lot of workflow templates. If you see the screen , two of those belong to SharePoint.

1. SharePoint 2007 Sequential workflow
2. SharePoint 2007 State Machine workflow

Brief Overview

Sequential workflow represents a workflow as a sequence of steps that must be executed in order until the last activity is completed. A state machine workflow 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. On the right side is a typical example of a Sequential workflow. When you select any of these workflow templates, it executes the workflow wizard that allows debugging on the workflows on SharePoint that requires special permissions. For e.g. this wizard takes care of deploying workflow customization on Global Assembly Cache (GAC).

2.JPG<path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"><lock aspectratio="t" v:ext="edit"><shape id="Picture_x0020_1" style="VISIBILITY: visible; WIDTH: 209.25pt; HEIGHT: 185.25pt" alt="Bb386211_SP_Sequential(en-us,VS_90).png" type="#_x0000_t75" o:spid="_x0000_i1025"><imagedata o:title="Bb386211_SP_Sequential(en-us,VS_90)" src="file:///C:\DOCUME~1\nishithp\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.png">

Step 1. Select the workflow and the site for debugging

As soon as you select any of the workflow templates, (for this article, I am assuming that you selected the SharePoint 2007 Sequential Workflow), it presents a simple Wizard during project creation to capture settings in an easy-to-use Wizard. In the first step, it asks you to give the workflow a name and also choose a valid SharePoint site where the workflow will be deployed and debugged. One thing would be a restriction on this site selection is that this site should be a local site and cannot be a remote SharePoint site. I hope this issues gets resolved in upcoming SP1 version of VS 2008 . Click on "Next" to move to next step.

3.JPG<path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"><lock aspectratio="t" v:ext="edit"><shape id="Picture_x0020_10" style="VISIBILITY: visible; WIDTH: 229.5pt; HEIGHT: 183pt" type="#_x0000_t75" o:spid="_x0000_i1028"><imagedata src="file:///C:\DOCUME~1\nishithp\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.png">

Step 2 : Choosing the library or list

Since you have selected the SharePoint site on the first step, this time you need to associate the workflow template with a document library or list. Before the VSTO 2008, this work has to be outside by going in the IDE of SharePoint. In this , you choose the document library or the lists. One thing to be aware is that, this wizard does not allow you to create new lists or library. This work has to be still done either manually by going to SharePoint or by using SharePoint object Model. Click on "Next" to move to next step.

4.JPG<shape id="Picture_x0020_13" style="VISIBILITY: visible; WIDTH: 228.75pt; HEIGHT: 182.25pt" type="#_x0000_t75" o:spid="_x0000_i1027"><imagedata src="file:///C:\DOCUME~1\nishithp\LOCALS~1\Temp\msohtmlclip1\01\clip_image003.png">

Step3. : Invoking a workflow

On the last step, wizard lets you configure how an instance of your workflow can be started. There are three ways as shown on the screen

1. Manually by users

2. When an item is created

3. When an item is changed

The first two are selected by default for the easy. After setting these simple configurations in place, the wizard completes, and VSTO creates the new project.

5.JPG<shape id="Picture_x0020_16" style="VISIBILITY: visible; WIDTH: 229.5pt; HEIGHT: 182.25pt" type="#_x0000_t75" o:spid="_x0000_i1026"><imagedata src="file:///C:\DOCUME~1\nishithp\LOCALS~1\Temp\msohtmlclip1\01\clip_image005.png">

Project created : Lets play now

After setting this, a project gets created and by default , few files like features.xml, workflow.xml etc gets created. Now you if you are an expert on workflow foundation, This is your time to do something with the workflow based on your business requirement. Once done, deployment is also as easy as pressing F5. Once deployment, workflow can be debugged by well within the Visual Studio IDE

6.JPG<shape id="Picture_x0020_25" style="VISIBILITY: visible; WIDTH: 228pt; HEIGHT: 165.75pt" type="#_x0000_t75" o:spid="_x0000_i1025"><imagedata src="file:///C:\DOCUME~1\nishithp\LOCALS~1\Temp\msohtmlclip1\01\clip_image007.png">

Conclusion

Earlier debugging the workflow developed in WF and deployed in SharePoint requires a lot of manual steps to be done. These SharePoint workflow templates have brought a sigh of relief for all those developers. This simple wizard has really avoided lot of manual process. I am sure there are much more you will find in Visual studio 2008.

Happy Coding

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
India India
Nishith Pathak is an avid reader,Prolific writer, Speaker for Microsoft India,Published Author of APress and a Microsoft Purist.He is MVP, MCPD, MCTS MCSD.Net,MCAD.Net(EA),MCSD. His proficiency lies in exploring Microsoft technology and to share them with other peers. He is a contributing author and an avid technical reviewer for multiple electronic and print publications. He has recently co-authored a book on WCF called Pro WCF: Microsoft Practical SOA Implementation for APress Inc, USA. Over the years, he has also been involved in providing consultancy and training services to corporations. He has been awarded with Microsoft Most Valuable Professional (MVP).Working since beta version of .Net makes his competecy in .Net. He can be contacted at NisPathak@Hotmail.com or at his blog http://DotNetPathak.Blogspot.com. Currently he is focused on key areas of the Microsoft platform, specifically Distributed Computing, service orientation and exploring VISTA and help companies architecting solutions based on Service Oriented Architecture.

Comments and Discussions

 
GeneralMy vote of 1 Pin
avikerchithi5-Jul-11 10:29
avikerchithi5-Jul-11 10:29 
GeneralMy vote of 1 Pin
mbadi25-Jun-10 20:54
mbadi25-Jun-10 20:54 
QuestionHow to access remote site Pin
krishna36917-May-10 12:43
krishna36917-May-10 12:43 
General64-bit problem with Sharepoint Sequential Workflow Template [modified] Pin
Jakob Flygare19-Jan-10 10:46
Jakob Flygare19-Jan-10 10:46 
Generalhelp!!!!!!!!!!!!!! Pin
siddhesh15930-Jul-09 21:54
siddhesh15930-Jul-09 21:54 
GeneralI'm having a problem in deploying the above sample in the second time Pin
sabithadivakaran31-May-09 22:52
sabithadivakaran31-May-09 22:52 
GeneralRe: I'm having a problem in deploying the above sample in the second time Pin
Chintan.Desai5-Apr-13 0:06
Chintan.Desai5-Apr-13 0:06 
QuestionCreate visual studio 2008 workflow to a sharepoint sub sites Pin
Robi-Robo18-May-09 20:28
Robi-Robo18-May-09 20:28 
Hi Nishith,

Can you please tell about how to create and choose deploy location of a visual studio workflow to sharepoint sub sites?

My problem is that i have a default sharepoint site in my sharepoint server 80 port. On this location i have created a new web application and on this web application i created seven sub sites. now i can't able to choose the sub sites url while i am trying to create a workflow.
Any suggestions please let me know.

Robi
Software Programmer

Questionwf task e-mail Pin
don evangelista28-Jan-09 16:51
don evangelista28-Jan-09 16:51 
Questionworkflow task e-mail Pin
don evangelista28-Jan-09 16:50
don evangelista28-Jan-09 16:50 
AnswerRe: workflow task e-mail Pin
Ozgur KOC19-Mar-09 22:49
Ozgur KOC19-Mar-09 22:49 
GeneralSharepoint workflow with VS2008 - Configurable Approver Pin
Member 344944230-Oct-08 11:27
Member 344944230-Oct-08 11:27 
GeneralRe: Sharepoint workflow with VS2008 - Configurable Approver Pin
fred_11-Mar-10 5:39
fred_11-Mar-10 5:39 
GeneralRe: Sharepoint workflow with VS2008 - Configurable Approver Pin
Member 84421737-Dec-11 22:56
Member 84421737-Dec-11 22:56 
QuestionWhat about production deployment? Pin
McSafe19-Aug-08 23:02
McSafe19-Aug-08 23:02 
AnswerRe: What about production deployment? Pin
Nishith Pathak20-Aug-08 20:06
Nishith Pathak20-Aug-08 20:06 
QuestionDifficulty moving workflow to sharepoint site Pin
Member 456347529-Jul-08 7:33
Member 456347529-Jul-08 7:33 
AnswerRe: Difficulty moving workflow to sharepoint site Pin
Nishith Pathak20-Aug-08 20:04
Nishith Pathak20-Aug-08 20:04 
QuestionWF in VS 2008 on Client machine Pin
nmq3-Jul-08 20:03
nmq3-Jul-08 20:03 
AnswerRe: WF in VS 2008 on Client machine Pin
nmq7-Jul-08 23:16
nmq7-Jul-08 23:16 
GeneralRe: WF in VS 2008 on Client machine Pin
HansErik20-Aug-08 4:44
HansErik20-Aug-08 4:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.