共用方式為


Workflow Initiation in Windows SharePoint Services

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.

All Windows SharePoint Services workflows must start with the OnWorkflowActivated activity. This activity initializes the correlation between the workflow instance and the correlation token, so that the Windows Workflow Foundation (WF) runtime can correctly direct incoming messages to this workflow instance. Each new SharePoint workflow application project you create contains an OnWorkflowActivated activity as the first activity by default.

Using the Information in the OnWorkflowActivated Activity

When a Windows SharePoint Services workflow is initiated, the WorkflowProperties property of the OnWorkflowActivated activity returns an SPWorkflowActivationProperties object that represents the initial properties of the workflow as it starts, such as the user who initiated the workflow, and the list and item to which the workflow was initiated. Any activity that needs access to the initiation data of the workflow, such as the workflow ID, can refer to the SPWorkflowActivationProperties object variable specified in the OnWorkflowActivated activity.

You can use the initiation properties from any other activity within the workflow, and they are especially useful when you are using a Code activity to manipulate the Windows SharePoint Services item on which the workflow is running.

For more information about the Windows Workflow Foundation, including using the Visual Studio 2005 Designer for Windows Workflow Foundation to create workflow solutions, visit the Windows Workflow Foundation Developer Center.

Setting the Properties of the OnWorkflowActivated Activity

When you open a new SharePoint workflow application project, an OnWorkflowActivated activity is the first activity by default, and its required properties are defined by default. Open the Properties window to view the properties for the selected activity.

See Also

Concepts

Workflow Activities for Windows SharePoint Services Overview

How Windows SharePoint Services Processes Workflow Activities

Correlation Tokens in Workflows