This is Part 1 of 4 for creating a state machine workflow using SharePoint 2010 with Visual Studio 2010 and c#. To read the introductions please click here.
Let’s get started and create our workflow using Visual Studio 2010.
We will now create our Visual studio solution and do a little bit of spring cleaning in the solution to make it easier to work with.
Creating the VS project.
- Load up Visual Studio 2010
- Select new project
- Select c#
- Select SharePoint
- Select SharePoint 2010
- Select the state machine workflow template
- Call the project DevJobsStateWorkflow
- Then click the ok button.
The SharePoint customization wizard will now appear
- Select the URL for your team site (where your DevJobs libray exists)
- Select Deploy as a farm solution. (sandboxed solution should be greyed out)
- Click next
On the ‘specify the workflow name for debugging’ screen:
- Click next.
Select the lists you will use whilst debugging:
- Select DEVJobs in the library or list to associate yr workflow.
- Click next.
On the specify the conditions for how your workflow is started screen - Check a user manually starts the workflow
- Check the workflow starts when an item is created.
- Click Finish.
The solution will now be created. That’s the simple bit done ;-)
Solution Tidy up – Time for a Spring Clean
By default our project will name the workflow as workflow1 everywhere which is meaningless, useless and generic for all new workflows. So let’s give it a semi meaningful name for our simple solution.
Let us start by renaming the workflow to be called ‘WorkFlowDevJobs’
- Open the WorkFlow1.cs class file and go to code view
- Perform a global replace for Workflow1 replacing with WorkFlowDevJobs.
- Press CTRL+Shift+H for the replace in files dialog
- Select the replace all option
- Rebuild the solution and make sure no errors occur. If you do get errors run for the hills before your computers epto plasmatic computer core overheats and explodes ;-) just trying to make this semi interesting ;-)
- The solution should be error free – Save then Close the solution.
Click here for Part 2
No comments:
Post a Comment