Building Simple Custom Approval Workflows with InfoPath 2007 Forms
Summary: Learn how to build a simple custom approval workflow by using Microsoft Office InfoPath 2007 forms.
Applies to: Microsoft Office SharePoint Server 2007, Microsoft Office InfoPath 2007
Patrick Tisseghem, U2U
July 2007
![]() The interaction with users involved in a workflow in Microsoft Office SharePoint Server 2007 can be accomplished by using Microsoft Office InfoPath 2007 forms. The benefit of using Office InfoPath 2007 forms instead of ASPX pages is that the former can also be displayed by the 2007 Microsoft Office system clients. In this Office Visual How To, I'll work out a small custom workflow that shows the possible role of InfoPath 2007 forms. Configure It You can display four types of Office InfoPath 2007 forms in SharePoint Server 2007:
This how-to discusses the first three types of forms. Both the association and the initiation form must work with a main data source that is defined within the same namespace. All forms must be published to a network location with the alternate access path left blank. ![]() The following code examples show how to interact programmatically with the InfoPath 2007 forms that are displayed to the user during the various stages of the workflow life cycle. Reading the Data from the Association and the Initiation Forms In the workflow code-behind classes, a variable named workflowProperties of type Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties is created and populated with Office SharePoint Server and workflow contextual data. The InitiationData property is exposed at this level, giving you access to the data entered in both the association and the initiation form. This data is typically processed during the activation of the workflow. The data is made available as an XML string that can be processed through the use of a System.Xml.XmlDocument instance and the execution of XPath statements, as shown in the following code example.
Reading the Data from the Edit Task Form Data entered by the users in the edit task form is retrieved through the ExtendedProperties hash table that stores key/value pairs. The following code shows how the value of the TaskStatus field (one that is set when clicking the approve or reject button in the InfoPath form) and the comments entered by the approver in the form are retrieved.
Deploy It A custom workflow built with Microsoft Visual Studio 2005 is compiled into a .NET assembly and deployed in the global assembly cache. The workflow template is made available at the level of the site collection through a Feature. The InfoPath 2007 templates that are part of the workflow are published to a subfolder of the workflow Feature folder. You define this subfolder in the feature.xml file via the Property element, with the Key attribute set to RegisterForms.
In the elementmanifest file (the workflow.xml in the project), each of the Microsoft InfoPath 2007 templates is registered and connected to the proper phase in the workflow lifecycle in the MetaData section of the XML.
|
![]() ![]() Length: 10:00 | Size: 12.2 MB | Type: WMV file ![]() |