Creating Declarative, No-Code Workflow Editors
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
The websvcWebPartPages Web Service in Windows SharePoint Services contains methods that enable a declarative rules-based, code-free workflow editor, such as Office SharePoint Designer 2007, to create workflow templates and associate them with specific SharePoint lists.
These methods include:
Use this method to get a language-specific list of the valid workflow actions installed for Windows SharePoint Services. This enables an application created to act as a declarative workflow editor to display the actions in its user interface.
The list returned is a merged list that contains the contents of all the .actions files installed on the server, with the core workflow actions included with Windows SharePoint Services by default listed first.
For more information about workflow actions, see Office SharePoint Designer 2007 Overview.
Use this method to validate the workflow markup of a declarative workflow, and optionally, create the support objects necessary for that workflow to run. This includes:
Creating the workflow task list, if a task list is not specified in the workflow configuration data, or the specified task list doesn’t exist.
Setting each workflow task content types to the specified edit form.
The method takes the following parameters:
XML that represents a workflow markup file in XOML format.
XML that represents a workflow rules markup in RULES format.
For more information about the XOML and RULES workflow formats, see Windows Workflow Foundation.
XML that represents a complete workflow configuration file that adheres to the workflow configuration schema.
For more information about the workflow configuration schema, see Workflow Configuration Schema Overview.
A flag value that specifies whether to just validate the workflow markup, or to validate the workflow markup and create the support objects as well.
Use this method to create a workflow template, and associate that workflow template with the specified SharePoint list.
This method takes the following parameters:
The path to the workflow configuration file to be used for this workflow.
The version of the workflow configuration file to use.
The workflow configuration file contains the information necessary to create a workflow template in Windows SharePoint Services from the specified workflow markup and rules files, and to associate it to a specific SharePoint list. Information included in the workflow configuration file includes:
The workflow markup and rules files to use, including the appropriate version of those files to use.
The SharePoint list to which the workflow should be associated.
The task list and history list for the workflow to use.
Conditions under which the workflow starts.
Workflow initiation form location, data fields, and default values.
The workflow configuration file must adhere to the workflow configuration schema. For more information, see Workflow Configuration Schema Overview.
When the declarative workflow template is created and associated with the specified list, SPWorkflowTemplate and SPWorkflowAssociation objects are created to represent the workflow template and association, respectively. For declarative workflows, the IsDeclarative property of each object is set to True.
Windows SharePoint Services includes a just-in-time compiler to compile the workflow assembly the first time that workflow is started on an item. Windows SharePoint Services retains the compiled workflow in memory until it is called again, much like servers cache compiled ASPX pages to speed execution performance the next time the page is called.
Each time a workflow is started on an item, Windows SharePoint Services determines whether the workflow was deployed as an assembly or as declarative markup. If a workflow assembly exists, Windows SharePoint Services calls that assembly to create the workflow instance. If the workflow was deployed as declarative markup, Windows SharePoint Services next determines whether or not it already has a workflow assembly compiled from that markup in memory. If it has, then Windows SharePoint Services calls the in-memory complied workflow to create the workflow instance. If not, Windows SharePoint Services uses its just-in-time compiler to compile the workflow markup into an in-memory workflow, which it then calls to create the workflow instance.
For a given site, declarative workflows must be stored in a site-level document library called Workflows. The files for each declarative workflow must be stored in a separate folder in the Workflow document library. This includes the workflow markup (.xoml) file, the rules file, and the workflow configuration file. We strongly recommend you also store any workflow forms in the workflow folder as well.