Summary: Examine new capabilities built in to the Microsoft Office SharePoint Server 2007 Enterprise Edition, which enable business process automation and simplify the business process. This article is part 2 of 2.
Custom Permission Request Workflow
One of the most innovative features of the new MOSS 2007 Enterprise Edition is the workflow feature. The new workflow capabilities are extensive, including built-in support for the following types of workflow:
Approval
Collect Feedback
Collect Signatures
Disposition Approval
Group Approval
Translation Management
Issue Tracking
As a site administrator, you can instantiate these built-in workflows on any entity within MOSS with a few simple configuration steps.
However, for the permission request solution, a custom workflow is required to emulate properly the manual business process that the workflow is replacing. The workflow must accommodate sending various e-mail messages throughout the process, and depending on whether the request is approved, generate XML to be processed to add the requestor to the Members group within MOSS.
MOSS also provides a mechanism to create custom workflows. There are two primary developer tools to use for this: Microsoft Office SharePoint Designer 2007 and Microsoft Visual Studio 2005 Extensions for Microsoft Windows Workflow Foundation. Using SharePoint Designer allows a business analyst or a developer to use the workflow activities that come with Windows Workflow Foundation and MOSS. The built-in workflow actions that you can use by default in SharePoint Designer include the following:
Setting list metadata
Creating, copying, deleting, or changing list items (including documents)
Checking items in or out
Pausing, starting, or stopping the workflow
Sending e-mail messages
Setting the moderation status of an item
Setting an item's metadata
Assigning tasks
You can create custom workflows with SharePoint Designer by selecting an existing document library or list within an existing MOSS or Windows SharePoint Services 3.0 site, and then on the File menu, point to New and then click Workflow. The workflow designer wizard appears, allowing you to create a custom workflow without writing a single line of code. The workflow designer allows you to add conditions and actions to the workflow to determine when to execute specific actions.
For example, using the built-in actions mentioned earlier, you could develop a custom workflow that checks a metadata column of a particular document in a document library, and based on the value send an e-mail message or assign a task to the appropriate team member. In any case, SharePoint Designer allows for great flexibility in designing custom workflows without the need to write code.
Using Visual Studio 2005 with the Windows Workflow Foundation add-in allows you to create custom workflow actions and complex custom workflows. The add-in for Visual Studio imports Windows Workflow Foundation activities that are available by default for you to use in designing workflows. These activities are included in a Workflow toolbox and you can drag them to the design surface of the custom workflow. The next section examines this in more detail and describes the development of the custom workflow activity used in the permission request solution.
Figures 13a and 13b show the built-in workflow activities that are included with the Windows Workflow Foundation add-in for Visual Studio in the Workflow toolbox. Figure 13a shows the built-in activities for a custom state-machine workflow project.
Figure 13a. State-machine built-in workflow activity
Figure 13b shows the built-in activities for a custom sequential workflow project. For more information, see the workflow resources in Additional Resources.
Figure 13b. Sequential Workflow built-in workflow activity in Visual Studio 2005 toolbox
Although most of the actions that must be included in this permission request workflow are available as standard workflow activities with Windows Workflow Foundation and MOSS, a custom activity was developed to generate the XML file from the submitted request, which could then be processed on other servers within the SharePoint farm.
The custom workflow activity was developed with Visual Studio 2005 and Windows Workflow Foundation Extensions add-in. The activity was then deployed to the MOSS environment and used within a custom workflow. The custom workflow was developed by using SharePoint Designer.