___________________________________________________________________________________________________________________
Table of Contents:
1. Setting up your environment for writing VS2005 workflows.
2. Writing an ultra basic workflow, deploying it, and slicing dicing how it worked.
3. Making that workflow more complex, adding if/else, and a bunch of activities that sort of make it more interesting.
4. Adding user interaction to that workflow using Infopath forms.
5. Authoring SharePoint 2007 Workflows using VS2008.
___________________________________________________________________________________________________________________
Microsoft introduced the new SharePoint 2007 workflow templates with VS2008. I'm sorry, but I don't like what they introduced. Sorry to be so blunt, but someone has to be honest. My #1 reason for not liking what they introduced is that the SharePoint 2007 WF Templates in VS2008 produce code that is not deployable. You cannot package it up as a feature or solution and hand it over to your infrastructure guy with a bad attitude. Sorry MSFT, but developers do not deploy - infrastructure & QA guys do.
Luckily, you can author your own WF template in VS2k8 - your own template that will allow you to very easily create features and solutions that any good project team would appreciate.
Here are the steps:
- Author a new class library project. I'm gonna call mine "SampleWorkflow".
- Add the following references -
- Delete the "Class1.cs" file.
- Create a folder structure as shown below:
- You will note in step #4 above that:
- I have strong named my class library.
- I have copied WSPBuilder in as well.
- I have created a folder structure, similar to the 12 directory - well established community standard, I am not willing to give it up until MSFT tools work.
- I have added an install.bat. Here is my install.bat -
1: @SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm"
2: @SET GACUTIL="c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe"
3: @SET WSPPBUILDER="WspBuilder\WspBuilder.exe"
4:
5: @echo off
6: Echo Creating Solution Package
7: %WSPPBUILDER% -outputpath solution -Excludepaths bin
8:
9: Echo Retracting Solution
10: stsadm -o retractsolution -name SampleWorkflow.wsp -immediate
11: stsadm -o execadmsvcjobs
12:
13: Echo Deleting Solution
14: stsadm -o deletesolution -name SampleWorkflow.wsp
15:
16: Echo Adding Solution
17: stsadm -o addsolution -filename Solution\SampleWorkflow.wsp
18:
19: Echo Deploying solution
20: stsadm -o deploysolution -name SampleWorkflow.wsp -immediate -allowGacDeployment
21: stsadm -o execadmsvcjobs
22:
23: Echo Resetting IIS
24: IISRESET
- Edit the Project's Build Events to call this Install.bat on every successful build.
- Close Visual Studio (LOL, yeah!).
- Now, open the .csproj file in Notepad, and make the following modifications -
- At the Project\PropertyGroup element, add the following element -
1: <ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- At the Project element, right below <Import Project = "$MSBuild .. ", add the following element
1: <Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets" />
- Excellent, now reopen the CSProject, and add your first workflow as shown below:

- From the toolbox, drag drop the "onWorkflowActivated" activity under the "SharePoint workflow" area.
- Set the correlation token.
- You're all set !! For further steps around the process of actually authoring the workflow, the steps are exactly similar to VS2005, and can be found here -
___________________________________________________________________________________________________________________
1. Setting up your environment for writing VS2005 workflows.
2. Writing an ultra basic workflow, deploying it, and slicing dicing how it worked.
3. Making that workflow more complex, adding if/else, and a bunch of activities that sort of make it more interesting.
4. Adding user interaction to that workflow using Infopath forms.
5. Authoring SharePoint 2007 Workflows using VS2008.
___________________________________________________________________________________________________________________