Monday, August 3, 2009

Workflows: Major Microsoft.Windows.SharePoint.Workflow Objects

The Microsoft.SharePoint.Workflow namespace represents the workflow functionality contained in Windows SharePoint Services.

  • SPWorkflowTemplateCollection object: Represents the workflow templates currently deployed on a site.
  • SPWorkflowTemplate object: Represents a workflow template and contains properties you can use to get or set information about the template, such as the instantiation data and the history and task lists for the template.
  • To associate a workflow to a list or document library, use the AddWorkflowAssociation method of the SPList object.
  • To associate a workflow with a content type, use the AddWorkflowAssociation method of the SPContentType object.
  • To create the appropriate workflow association, use the CreateListAssociation, CreateListContentTypeAssociation, or CreateSiteContentTypeAssociation method of the SPWorkflowAssociation object itself.
  • Use the RemoveWorkflowAssociation method to remove a workflow association from a list.
  • Use the RemoveWorkflowAssociation method to remove a workflow association from a site or list content type.
  • Each SPWorkflowAssociation object represents a workflow template that is associated with a specific list or content type, and that contains properties that return custom information about that workflow's association with the specific list or content type. This information includes whether the workflow is enabled, whether the workflow can be started automatically, and the list or content type with which the workflow has been associated.
  • The SPWorkflowCollection represents the workflow instances that have run or are currently running on a given list item.
  • Each SPWorkflow object contains properties that return information about the workflow instance, such as whether the workflow has completed, its internal state, and its workflow history list.
  • Use the Workflows property to return an SPWorkflowCollection object that represents the workflows currently running for that list item.

Managing Running Workflow Instances Programmatically
Users interact with the workflows running on items individually, through the Windows SharePoint Services user interface. But Windows SharePoint Services provides functionality for you to centrally control the running instances of workflows across your site collection through the object model. Use the SPWorkflowManager object to manage the running instances of workflows across a site collection. The SPWorkflowManager object has no equivalent in the user interface. Use the SPWorkflowManager object to:

  • Start, run, or cancel workflows.
  • Return all the workflows currently running on a specific item.
  • Perform other workflow administration operations.

No comments: