Class WorkflowExtensions
Class for workflow extension methods
Inheritance
System.Object
WorkflowExtensions
Assembly: PnP.Framework.dll
Syntax
public static class WorkflowExtensions : object
Methods
Adds a workflow definition
Declaration
public static Guid AddWorkflowDefinition(this Web web, WorkflowDefinition definition, bool publish = true)
Parameters
Web
web
the target web
|
WorkflowDefinition
definition
the workflow definition to add
|
System.Boolean
publish
specify true to publish workflow definition
|
Returns
Adds a workflow subscription
Declaration
public static Guid AddWorkflowSubscription(this List list, string workflowDefinitionName, string subscriptionName, bool startManually, bool startOnCreate, bool startOnChange, string historyListName, string taskListName, Dictionary<string, string> associationValues = null)
Parameters
List
list
The target list
|
System.String
workflowDefinitionName
The name of the workflow definition
WorkflowExtensions.GetWorkflowDefinition
|
System.String
subscriptionName
The name of the workflow subscription to create
|
System.Boolean
startManually
if True the workflow can be started manually
|
System.Boolean
startOnCreate
if True the workflow will be started on item creation
|
System.Boolean
startOnChange
if True the workflow will be started on item change
|
System.String
historyListName
the name of the history list. If not available it will be created
|
System.String
taskListName
the name of the task list. If not available it will be created
|
Dictionary<System.String, System.String>
associationValues
the name-value pairs for workflow definition
|
Returns
Guid
Guid of the workflow subscription
|
Adds a workflow subscription to a list
Declaration
public static Guid AddWorkflowSubscription(this List list, WorkflowDefinition workflowDefinition, string subscriptionName, bool startManually, bool startOnCreate, bool startOnChange, string historyListName, string taskListName, Dictionary<string, string> associationValues = null)
Parameters
List
list
The target list
|
WorkflowDefinition
workflowDefinition
The workflow definition.
WorkflowExtensions.GetWorkflowDefinition
|
System.String
subscriptionName
The name of the workflow subscription to create
|
System.Boolean
startManually
if True the workflow can be started manually
|
System.Boolean
startOnCreate
if True the workflow will be started on item creation
|
System.Boolean
startOnChange
if True the workflow will be started on item change
|
System.String
historyListName
the name of the history list. If not available it will be created
|
System.String
taskListName
the name of the task list. If not available it will be created
|
Dictionary<System.String, System.String>
associationValues
the name-value pairs for workflow definition
|
Returns
Guid
Guid of the workflow subscription
|
Cancels a workflow instance
Declaration
public static void CancelWorkFlow(this WorkflowInstance instance)
Parameters
WorkflowInstance
instance
the workflow instance to cancel
|
Deletes a workflow definition
Declaration
public static void Delete(this WorkflowDefinition definition)
Parameters
WorkflowDefinition
definition
the workflow defition to delete
|
Declaration
public static void Delete(this WorkflowSubscription subscription)
Parameters
WorkflowSubscription
subscription
the workflow subscription to delete
|
Returns all instances of a workflow for this subscription
Declaration
public static WorkflowInstanceCollection GetInstances(this WorkflowSubscription subscription)
Parameters
WorkflowSubscription
subscription
the workflow subscription to get instances
|
Returns
WorkflowInstanceCollection
Returns a WorkflowInstanceCollection object
|
Returns a workflow definition
Declaration
public static WorkflowDefinition GetWorkflowDefinition(this Web web, Guid id)
Parameters
Web
web
the target web
|
Guid
id
the id of workflow definition
|
Returns
WorkflowDefinition
Returns a WorkflowDefinition object
|
Returns a workflow definition for a site
Declaration
public static WorkflowDefinition GetWorkflowDefinition(this Web web, string displayName, bool publishedOnly = true)
Parameters
Web
web
the target web
|
System.String
displayName
the workflow definition display name, which is displayed to users
|
System.Boolean
publishedOnly
Defines whether to include only published definition, or all the definitions
|
Returns
WorkflowDefinition
Returns a WorkflowDefinition object
|
Returns all the workflow definitions
Declaration
public static WorkflowDefinition[] GetWorkflowDefinitions(this Web web, Boolean publishedOnly)
Parameters
Web
web
The target Web
|
Boolean
publishedOnly
Defines whether to include only published definition, or all the definitions
|
Returns
WorkflowDefinition[]
Returns all WorkflowDefinitions
|
Returns alls workflow instances for a site
Declaration
public static WorkflowInstanceCollection GetWorkflowInstances(this Web web)
Parameters
Returns
WorkflowInstanceCollection
Returns a WorkflowInstanceCollection object
|
Returns alls workflow instances for a list item
Declaration
public static WorkflowInstanceCollection GetWorkflowInstances(this Web web, ListItem item)
Parameters
Web
web
the target web
|
ListItem
item
the target list item to get workflow instances
|
Returns
WorkflowInstanceCollection
Returns a WorkflowInstanceCollection object
|
Returns a workflow subscription (associations) for a list
Declaration
public static WorkflowSubscription GetWorkflowSubscription(this List list, string name)
Parameters
List
list
The target list
|
System.String
name
Name of workflow subscription to get
|
Returns
WorkflowSubscription
Returns a WorkflowSubscription object
|
Returns a workflow subscription
Declaration
public static WorkflowSubscription GetWorkflowSubscription(this Web web, Guid id)
Parameters
Web
web
The web to get workflow subscription
|
Guid
id
The id of the workflow subscription
|
Returns
WorkflowSubscription
Returns a WorkflowSubscription object
|
Returns a workflow subscription for a site.
Declaration
public static WorkflowSubscription GetWorkflowSubscription(this Web web, string name)
Parameters
Web
web
The web to get workflow subscription
|
System.String
name
The name of the workflow subscription
|
Returns
WorkflowSubscription
Returns a WorkflowSubscription object
|
Returns all the workflow subscriptions (associations) for the web and the lists of that web
Declaration
public static WorkflowSubscription[] GetWorkflowSubscriptions(this Web web)
Parameters
Returns
WorkflowSubscription[]
Returns all WorkflowSubscriptions
|
Publish a custom event to a target workflow instance
Declaration
public static void PublishCustomEvent(this WorkflowInstance instance, string eventName, string payload)
Parameters
WorkflowInstance
instance
the workflow instance to publish event
|
System.String
eventName
The name of the target event
|
System.String
payload
The payload that will be sent to the event
|
Declaration
public static void ResumeWorkflow(this WorkflowInstance instance)
Parameters
WorkflowInstance
instance
the workflow instance to resume
|
Starts a new instance of a workflow definition against the current item
Declaration
public static Guid StartWorkflowInstance(this ListItem item, Guid subscriptionId, IDictionary<String, Object> payload)
Parameters
ListItem
item
The target item
|
Guid
subscriptionId
The ID of the workflow subscription to start
|
IDictionary<String, Object>
payload
Any input argument for the workflow instance
|
Returns
Guid
The ID of the just started workflow instance
|
Starts a new instance of a workflow definition against the current item
Declaration
public static Guid StartWorkflowInstance(this ListItem item, string subscriptionName, IDictionary<string, object> payload)
Parameters
ListItem
item
The target item
|
System.String
subscriptionName
The name of the workflow subscription to start
|
IDictionary<System.String, System.Object>
payload
Any input argument for the workflow instance
|
Returns
Guid
The ID of the just started workflow instance
|
Starts a new instance of a workflow definition against the current web site
Declaration
public static Guid StartWorkflowInstance(this Web web, Guid subscriptionId, IDictionary<String, Object> payload)
Parameters
Web
web
The target web site
|
Guid
subscriptionId
The ID of the workflow subscription to start
|
IDictionary<String, Object>
payload
Any input argument for the workflow instance
|
Returns
Guid
The ID of the just started workflow instance
|
Starts a new instance of a workflow definition against the current web site
Declaration
public static Guid StartWorkflowInstance(this Web web, string subscriptionName, IDictionary<string, object> payload)
Parameters
Web
web
The target web site
|
System.String
subscriptionName
The name of the workflow subscription to start
|
IDictionary<System.String, System.Object>
payload
Any input argument for the workflow instance
|
Returns
Guid
The ID of the just started workflow instance
|