Walkthrough: Creating Office SharePoint Server 2007 Workflows in Visual Studio 2005

When you create workflows for Microsoft Office SharePoint Server 2007, you have the option to create the various forms that allow users to interact with a workflow by using a variety of technologies. This walkthrough demonstrates how to use Microsoft Office InfoPath 2007 to create those forms. The option to use Microsoft Office InfoPath 2007 is only available when you are also using Microsoft Office SharePoint Server 2007. For Windows SharePoint Services 3.0, it is necessary to use ASPX forms to collect data from the workflow initiator. Using Microsoft Office InfoPath 2007 enables users to interact with the workflows by using 2007 Microsoft Office system client applications, such as Microsoft Office Excel 2007, Microsoft Office Word 2007, Microsoft Office PowerPoint XML Format, and InfoPath Forms Services, as well as through a Web browser.

In this walkthrough, we will create a simple workflow that uses InfoPath forms. When initiated, the workflow will assign a task to the selected user, and then wait 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.

Following are the tasks that are described in this walkthrough:

  • 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 need to install the following:

  • Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System, with Visual Studio 2005 Extensions for Windows Workflow Foundation.

  • Microsoft Office SharePoint Server 2007

  • Microsoft Office InfoPath 2007

  • Microsoft Office SharePoint Server 2007 Software Development Kit (SDK)

NoteNote:

As with all Microsoft Office SharePoint Server 2007 development, you should create your workflows by using a development environment that closely resembles the environment where the code will be deployed. While 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 Microsoft Office SharePoint Server 2007-specific workflow activities require that Windows SharePoint Services and Microsoft Office SharePoint Server 2007 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, Microsoft Office SharePoint Server 2007 displays a custom initiation form which is used to collect three pieces of information from the user who started the workflow. The following information will be used in processing the workflow:

  • The Windows SharePoint Services login 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 has been marked as complete. After it is marked complete, the workflow sets the task to completed status in Microsoft Office SharePoint Server 2007 and ends the workflow activity.

Community Additions

ADD
Show: