編輯

共用方式為


Action element (WorkflowInfo)

Applies to: SharePoint 2016 | SharePoint Foundation 2013 | SharePoint Online | SharePoint Server 2013

Contains the information that is needed for the workflow engine to process a workflow activity, which is called an action in Microsoft SharePoint Foundation 2010. A workflow Action element represents a workflow activity, such as sending email notifications, updating SharePoint Foundation 2010 list items, creating and assigning tasks, and many other activities.

By default, SharePoint Foundation 2010 provides 23 built-in workflow actions. These are defined in the WSS.ACTIONS file.

Definition

<Actions>
    <Action>
        <Parameters>
        </Parameters>
        <RuleDesigner>
        </RuleDesigner>
        <DataSources>
        </DataSources>
        <Modifications>
            <Modification>
            </Modification>
        </Modifications>
        <ActionVariables>
        </ActionVariables>
        <ActionBody>
        </ActionBody>
        <ActionConditions>
        </ActionConditions>
    </Action>
</Actions>

Elements and attributes

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute

Description

**Name**

Required **text**. Represents the description of the workflow action that is displayed to the workflow editor.

**ClassName**

Required **text**. Fully qualified name of the class that implements the workflow action; for example, **Microsoft.SharePoint.WorkflowActions.EmailActivity**.

**Assembly**

Required **text**. The Microsoft .NET assembly name that contains instructions to implement the **Action** element. The text should include the PublicKeyToken, Version, and Culture.

**FunctionName**

Optional **text**. For sandboxed solutions, specifies the name of a function to call.

**Category**

Optional **text**. Provides a category for the workflow action. This **text** is used to filter the list of available actions.

**CreatesTask**

Optional **Boolean**. If set to **true**, a task list item is created in the workflow. If left blank, the assumption is **false**, and no task list items are created.

**CreatesInList**

Optional **text**. If a value is set for this attribute, the workflow creates an item in a list. Values must map to a parameter name that contains the **ID** of the list or document library.

**AppliesTo**

Required **text**. Indicates whether this workflow action should be available for lists, document libraries, or both. Valid values include **list**, **doclib**, and **all**.

**IsError**

Optional **Boolean**. If set to **true**, instances of this **Action** element are considered an error by the client application.

**ListModeration**

Optional **Boolean**. If set to **true**, this **Action** element applies to a list or document library that has content approval enabled. If left blank, the assumption is **false**.

**UsesCurrentItem**

Optional **Boolean**. If set to **true**, indicates that the current item should be used or modified. If set to **false** or left blank, this **Action** element uses only the SharePoint list or document library item that is specified.

**CreatedTaskFormType**

Optional **text**. Specifies the type of a created task: **DataCollectTask** to create a task that collects data from one user; **GroupAssignedTask** to create a task that collects data from one or more users; **TodoItemTask** to create a task that does not collect data from users but only exists for a user to validate that they have done something; or **TaskProcess** to create a task that has a form that allows for ad-hoc collaboration and might collect data from one or more users.

**__SolutionId**

Optional **text**. Specifies a GUID that the client application writes to the implementation-specific action. The server uses the GUID to help locate the assembly at run time of the workflow.

**SandboxedFunction**

Optional **Boolean**. If set to **true**, the client application inserts an implementation-specific action when this action is selected. The action should be configured to call a function defined by the conjunction of **AssemblyName**, **ClassName**, and **FunctionName**. If set, **AssemblyName**, **ClassName**, **FunctionName**, and **__SolutionId** must also be set.

Child elements

Parameters

RuleDesigner

DataSources

Modifications

ActionVariables

ActionBody

ActionConditions

Parent elements

Actions

Example

The following code example demonstrates how to construct an Action element so that it is displayed in the workflow editor. Note that this XML has been modified for readability.

    <WorkflowInfo>
      <Conditions>…</Conditions>
      <Actions Sequential="then" Parallel="and">
        <Action Name="Update my custom SharePoint list"
                ClassName="CustomActivities.OrderListFunctions"
                Assembly="CustomActivities,
                          PublicKeyToken=b03f5f7f11d50a3a,
                          Version=1.0.0.0,
                          Culture=neutral"
                Category="My Custom Actions"
                CreatesTask="true"
                CreatesInList="UpdateList"
                AppliesTo="all"
                ListModeration="false"
                UsesCurrentItem="true">
          <RuleDesigner Sentence="Update %1">
            <FieldBind Field="UpdateList"
                       Function="UpdateOrderList"
                       DesignerType="ChooseListItem"
                       ID="1"
                       Text="My Custom List">
            </FieldBind>
          </RuleDesigner>
          <Parameters>
            <Parameter Type="System.String, mscorlib"
                       Direction="In"
                       Name="UpdateList"
            </Parameters>
        </Action>
      </Actions>
    </WorkflowInfo>

See also