Terminating workflows

You can use a few service operations in the Workflow web service to terminate instances of site, reusable, and list workflows, depending on the workflow type and the identifiers available to you.

Terminating site workflows

You can use one of the following service operations to terminate a running site workflow instance:

Terminating reusable and list workflows

You can use one of the following service operations to terminate a running site workflow instance:

Example

The following code example uses the TerminateWorkflowByName service operation to terminate the latest running instance of the specified workflow for the current site.

public bool TerminateWorkflowForSite(string workflowName)
{
    try
    {
        // Use the TerminateWorkflowByName service operation to terminate 
        // the latest running instance of the specified site workflow 
        // for the current site.
        soapClient.TerminateWorkflowByName(
            "",
            workflowName,
            false);
    
        // If no error was received, the workflow was successfully 
        // terminated. If so, return true.
        return true;
    }
    catch
    {
        // An error occurred while trying to start the site workflow.
        return false;
    }
}

See Also

Concepts

Workflows

Operations

Managing workflow execution

Starting workflows

Reference

Web Service Reference