Class WorkflowExtensions
Class for workflow extension methods
Inheritance
System.Object
WorkflowExtensions
Namespace: Microsoft.SharePoint.Client
Assembly: PnP.Framework.dll
Syntax
public static class WorkflowExtensions : object
Class for workflow extension methods
public static class WorkflowExtensions : object
Adds a workflow definition
public static Guid AddWorkflowDefinition(this Web web, WorkflowDefinition definition, bool publish = true)
Web
web
the target web |
WorkflowDefinition
definition
the workflow definition to add |
System.Boolean
publish
specify true to publish workflow definition |
Guid
|
Adds a workflow subscription
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)
List
list
The target list |
System.String
workflowDefinitionName
The name of the workflow definition |
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 |
Guid
Guid of the workflow subscription |
Adds a workflow subscription to a list
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)
List
list
The target list |
WorkflowDefinition
workflowDefinition
The workflow definition. |
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 |
Guid
Guid of the workflow subscription |
Cancels a workflow instance
public static void CancelWorkFlow(this WorkflowInstance instance)
WorkflowInstance
instance
the workflow instance to cancel |
Deletes a workflow definition
public static void Delete(this WorkflowDefinition definition)
WorkflowDefinition
definition
the workflow defition to delete |
Deletes the subscription
public static void Delete(this WorkflowSubscription subscription)
WorkflowSubscription
subscription
the workflow subscription to delete |
Returns all instances of a workflow for this subscription
public static WorkflowInstanceCollection GetInstances(this WorkflowSubscription subscription)
WorkflowSubscription
subscription
the workflow subscription to get instances |
WorkflowInstanceCollection
Returns a WorkflowInstanceCollection object |
Returns a workflow definition
public static WorkflowDefinition GetWorkflowDefinition(this Web web, Guid id)
Web
web
the target web |
Guid
id
the id of workflow definition |
WorkflowDefinition
Returns a WorkflowDefinition object |
Returns a workflow definition for a site
public static WorkflowDefinition GetWorkflowDefinition(this Web web, string displayName, bool publishedOnly = true)
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 |
WorkflowDefinition
Returns a WorkflowDefinition object |
Returns all the workflow definitions
public static WorkflowDefinition[] GetWorkflowDefinitions(this Web web, Boolean publishedOnly)
Web
web
The target Web |
Boolean
publishedOnly
Defines whether to include only published definition, or all the definitions |
WorkflowDefinition[]
Returns all WorkflowDefinitions |
Returns alls workflow instances for a site
public static WorkflowInstanceCollection GetWorkflowInstances(this Web web)
Web
web
the target web |
WorkflowInstanceCollection
Returns a WorkflowInstanceCollection object |
Returns alls workflow instances for a list item
public static WorkflowInstanceCollection GetWorkflowInstances(this Web web, ListItem item)
Web
web
the target web |
ListItem
item
the target list item to get workflow instances |
WorkflowInstanceCollection
Returns a WorkflowInstanceCollection object |
Returns a workflow subscription (associations) for a list
public static WorkflowSubscription GetWorkflowSubscription(this List list, string name)
List
list
The target list |
System.String
name
Name of workflow subscription to get |
WorkflowSubscription
Returns a WorkflowSubscription object |
Returns a workflow subscription
public static WorkflowSubscription GetWorkflowSubscription(this Web web, Guid id)
Web
web
The web to get workflow subscription |
Guid
id
The id of the workflow subscription |
WorkflowSubscription
Returns a WorkflowSubscription object |
Returns a workflow subscription for a site.
public static WorkflowSubscription GetWorkflowSubscription(this Web web, string name)
Web
web
The web to get workflow subscription |
System.String
name
The name of the workflow subscription |
WorkflowSubscription
Returns a WorkflowSubscription object |
Returns all the workflow subscriptions (associations) for the web and the lists of that web
public static WorkflowSubscription[] GetWorkflowSubscriptions(this Web web)
Web
web
The target Web |
WorkflowSubscription[]
Returns all WorkflowSubscriptions |
Publish a custom event to a target workflow instance
public static void PublishCustomEvent(this WorkflowInstance instance, string eventName, string payload)
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 |
Resumes a workflow
public static void ResumeWorkflow(this WorkflowInstance instance)
WorkflowInstance
instance
the workflow instance to resume |
Starts a new instance of a workflow definition against the current item
public static Guid StartWorkflowInstance(this ListItem item, Guid subscriptionId, IDictionary<String, Object> payload)
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 |
Guid
The ID of the just started workflow instance |
Starts a new instance of a workflow definition against the current item
public static Guid StartWorkflowInstance(this ListItem item, string subscriptionName, IDictionary<string, object> payload)
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 |
Guid
The ID of the just started workflow instance |
Starts a new instance of a workflow definition against the current web site
public static Guid StartWorkflowInstance(this Web web, Guid subscriptionId, IDictionary<String, Object> payload)
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 |
Guid
The ID of the just started workflow instance |
Starts a new instance of a workflow definition against the current web site
public static Guid StartWorkflowInstance(this Web web, string subscriptionName, IDictionary<string, object> payload)
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 |
Guid
The ID of the just started workflow instance |