SharePoint Workflow Solutions
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.
Microsoft Office version
For more information, see Features Available by Application and Project Type.
Visual Studio Tools for Office provides tools to help you create custom workflow templates that manage the life cycle of documents and list items in a SharePoint Web site. The tools include a designer, a complete set of drag-and-drop activity controls, and the necessary assembly references. Visual Studio Tools for Office also includes the New Office SharePoint Workflow wizard, which significantly reduces the configuration steps that are required to debug the workflow template in Visual Studio.
To use the SharePoint workflow project templates, you must install Visual Studio on a computer that runs an operating system that supports Microsoft Office SharePoint Server 2007. You must also install Microsoft Office SharePoint Server 2007. For more information, see How to: Install Visual Studio Tools for Office to Develop for SharePoint Workflow Project Templates.
Microsoft Office SharePoint Server 2007 contains several built-in workflow templates. For example, if you want a new document to pass through a basic approval process, you can use the built-in Approval workflow template. You can also create custom workflow templates to manage advanced document processes.
For more information about SharePoint, see Windows SharePoint Services Overview and Microsoft Office SharePoint 2007 Server Product Overview.
When you add a workflow to a SharePoint library or list, you enforce a business process on all items in the library or list. A workflow describes the actions that the system or users must perform on each item, such as sending the item to be edited and then reviewed. These actions, called activities, are the building blocks of the workflow.
Workflows in a SharePoint Web site are stored as workflow templates. Therefore, you must create a SharePoint workflow template and deploy it to a SharePoint Web site. Use SharePoint administration tools to add the template to a library or list in a SharePoint 2007 Web site. Users can then start a workflow instance to process any item in the library or list. For more information, see Using workflows to manage processes.
Create SharePoint workflows by using the SharePoint 2007 Sequential Workflow or SharePoint 2007 State Machine Workflow project template.
A sequential workflow represents a workflow as a procession of steps that must be executed in order until the last activity is completed. The following illustration shows an example of a sequential workflow.
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. The following diagram shows an example of a state machine workflow.
For more information about workflow types, see Workflow Types.
Using the Wizard
When you create a SharePoint workflow project, you start by specifying your debug configuration settings in the New Office SharePoint Workflow wizard. The wizard stores these settings and creates a project in Solution Explorer. This project contains a code file, several files that are used to deploy the workflow template, and references to assemblies that you must have to create a custom SharePoint workflow template. For more information about these files and assembly references, see SharePoint Workflow Project Templates.
For step-by-step information, see How to: Create a SharePoint Workflow Project.
After you define all the steps in your business process, use the Designer for Windows Workflow Foundation to design a SharePoint workflow template. To open the designer, double-click Workflow1.cs or Workflow1.vb in Solution Explorer.
To design a workflow, add activities from the Toolbox to a workflow schedule on the designer. A workflow schedule contains the sequence of activities in the order that they should be performed.
There are two types of activities:
Simple activities perform a single unit of work, such as "delay for 1 day" or "start Web service."
Composite activities contain other activities; for example, a conditional activity might contain two branches.
Both types of activities are available in the Toolbox.
Activities can have properties, methods, and events. Use the Properties window to set the properties of an activity.
You can also create a custom activity. For more information, see Create a Custom Activity.
Activities are organized in the following two tabs in the Toolbox:
Windows Workflow Activities
The Windows Workflow tab contains activities that are provided by the Windows Workflow Foundation. You can use these activities to create workflow schedules for any kind of Windows workflow application.
For more information about the activities listed in the Windows Workflow tab, see Windows Workflow Foundation Activities. For more information about the Windows Workflow Foundation, see Windows Workflow Foundation Overview.
SharePoint Workflow Activities
The SharePoint Workflow tab contains specialized activities for Windows SharePoint Services 3.0 and SharePoint Server 2007. These activities simplify and streamline the development of document life cycle workflows. For more information about the activities listed in the SharePoint Workflow tab, see Workflow Activities for Windows SharePoint Services Overview.
Working with Activities in the Designer
Your workflow schedule can contain a combination of Windows Workflow activities and SharePoint Workflow activities.
The designer displays visual cues to help you position and configure activities correctly. When you drag an activity onto the workflow schedule, the designer displays green plus-sign (+) icons that show you valid locations for that activity in the workflow. You cannot position an activity in a location where it would not be valid. For example, you cannot position a Send activity as the first activity in a Listen activity branch. For more information about how to use the designer, see Visual Studio 2005 Designer for Windows Workflow Foundation Overview.
You might want to gather information from users at predefined times in the workflow. You can collect information by using forms or item properties.
Forms are similar to dialog boxes that contain questions and provide ways for users to give answers.
There are four types of forms that you can create for a workflow:
For example, you could design a form that collects feedback from document reviewers. Users must provide feedback before the workflow can continue. This type of a form is called a task form.
For more information about these types of forms, see Workflow Forms Overview.
You can create these forms as ASP.NET Web Forms pages (.aspx files) or InfoPath forms. For more information about how to use .aspx pages, see Workflow Forms Overview. For more information about how to use InfoPath forms, see InfoPath Forms for Workflows.
Visual Studio Tools for Office does not provide tools to simplify workflow forms development. Use the guidance in these two links to add forms to your workflow template.
You can also collect information from users by using the properties of an item in the SharePoint library or list. The main code file (Workflow1.cs or Workflow1.vb) declares an instance of the Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties.WorkflowProperties class named workflowProperties. Use the workflowProperties object to access the properties of the library or list in code. For an example, see Walkthrough: Creating and Debugging a SharePoint Workflow Solution.
You can debug a SharePoint workflow project just as you would debug other Visual Studio projects. When you start the Visual Studio debugger, Visual Studio Tools for Office uses the settings that you specify in the New Office SharePoint Workflow wizard to open the appropriate SharePoint 2007 Web site and automatically associate the workflow template with the appropriate library or list. Visual Studio Tools for Office also attaches the Visual Studio debugger to the SharePoint Services 3.0 process named w3wp.exe.
To test the workflow, you must start it manually. For more information, see Debugging SharePoint Workflow Solutions.
Visual Studio Tools for Office does not provide tools to simplify workflow template deployment. For deployment information, see the SharePoint Services 3.0 topic How to: Deploy a Workflow Template.