Walkthrough for SharePoint Server 2010 (ECM): Creating SharePoint 2010 Workflows in Visual Studio Using InfoPath Forms
Applies to: SharePoint Server 2010
When you create workflows for Microsoft SharePoint Server 2010, you have the option to create the various forms that enable users to interact with workflows by using various technologies. This walkthrough demonstrates how to use Microsoft InfoPath 2010 to create those forms. The option to use InfoPath 2010 is available only when you are also using SharePoint Server 2010. For Microsoft SharePoint Foundation 2010, you must use ASPX forms to collect data from the workflow initiator. Using InfoPath 2010 enables users to interact with the workflows by using Microsoft Office 2010 client applications such as Excel 2010, Word 2010, PowerPoint 2010, and InfoPath Forms Services, and also through a web browser.
In this walkthrough, you will create a simple workflow that uses InfoPath forms. When initiated, the workflow assigns a task to the selected user, and then waits until that user completes the task. The workflow uses one custom InfoPath form to collect initiation data from the user who starts the workflow, and another form to enable the assigned user to edit the workflow task and mark the task as complete.
This walkthrough describes the following tasks:
Designing custom InfoPath forms for workflow initiation and task editing.
Creating a workflow from existing workflow activities.
Passing information between the custom forms and the workflow itself.
Creating, updating, and completing a workflow task by using workflow activities.
To complete this walkthrough, you must install the following:
Microsoft Visual Studio 2010
Microsoft SharePoint Server 2010
Microsoft InfoPath 2010
As with all SharePoint Foundation development, you should create your workflows by using a development environment that closely resembles the environment where the code will be deployed. Although it is not always possible to completely replicate a production environment by using developer resources, making sure that the two environments are as similar as possible will greatly simplify your development and debugging processes. For example, the SharePoint Server 2010-specific workflow activities require that SharePoint Foundation and SharePoint Server 2010 be installed on the computer you use to develop the workflows.
The example workflow you create in this walkthrough is a basic one. When a user starts the workflow, SharePoint Server 2010 displays a custom initiation form, which is used to collect three pieces of information from the user who started the workflow. The following information is used in processing the workflow:
The SharePoint Foundation user name of the person who will be assigned tasks by the workflow.
Any instructions for completing the task.
Any other comments the workflow initiator wants to provide.
The workflow then creates a task and assigns it to the specified user. That user can edit the workflow task by using a custom task edit form. The task edit form contains a check box where the user can mark the task as complete. Each time the user edits the task, the workflow checks to verify whether the task is marked as complete. After it is marked complete, the workflow sets the task to completed status in SharePoint Server 2010 and ends the workflow activity.