SharePoint - Get Workflow Instances
Declaration
<AMSHAREPOINT ACTIVITY="get_workflowinstances" SITE="text" VERSION="text (options)" USERNAME="text" PASSWORD="text (encrypted)" IGNOREINVALIDCERTIFICATE="YES/NO" CERTIFICATE="text" TIMEOUT="number" RESULTDATASET="text" />
Description: Retrieves information with regards to existing workflow instances and populates a dataset with results. This activity supports retrieval of site and list workflow instances or data can be retrieved from instances associated to a particular workflow ID.
Practical Usage
Used to gather information regarding SharePoint workflow instances in order to perform other operations on them during subsequent steps.
Connection Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
Connection |
--- |
--- |
--- |
--- |
Indicates where this activity's SharePoint credentials should originate from. This is a visual parameter used only during design-time, thus, contains no properties or markups. The available options are:
|
Session |
Text |
Yes if Connection set to Session |
SharePoint Session1 |
SESSION="mySession1" |
The name of the session to associate with this activity. This parameter is active only if the Connection parameter above is set to Session. If the Connection parameter is set to Host, this parameter is ignored and the remainder of the parameters specified below become active. |
Version |
Text (options) |
Yes if Connection set to Host |
SharePoint 2010 |
|
The SharePoint version to associate with this activity. The available options are:
NOTE: Some SharePoint activities are only supported in SharePoint 2010 or newer. |
Site |
Text |
Yes if Connection set to Host |
(Empty) |
SITE="http://myServer/tech" |
The SharePoint site to access. A SharePoint site is a collection of pages, site templates, lists, and libraries configured for the purpose of achieving an express goal. |
Authentication type |
Text (options) |
No |
Default |
|
The method of authentication to utilize. Authentication types vary depending on the SharePoint version. Different parameters become active depending on which authentication method is selected. Below lists available authentication methods and their compatibility.
|
Username |
Text |
Yes |
(Empty) |
USERNAME="theUserName" |
A valid SharePoint username. This parameter may or may not be active depending on which option is selected under the Authentication type parameter. |
Password |
Text |
Yes |
(Empty) |
PASSWORD="encryptedText" |
A valid SharePoint password to authenticate the username entered above. This parameter may or may not be active depending on which option is selected under the Authentication type parameter. |
Domain |
Text |
Yes |
(Empty) |
DOMAIN="myServer" |
The domain that the user belongs to. This parameter may or may not be active depending on which option is selected under the Authentication type parameter. |
Certificate |
Text |
No |
(Empty) |
CERTIFICATE="C:\Temp\file.cer" |
The (DER encoded) certificate to use for SharePoint authentication. This parameter may or may not be active depending on which option is selected under the Authentication type parameter. |
Ignore invalid certificate |
Yes/No |
No |
No |
IGNOREINVALIDCERTIFICATE="yes" |
If set to YES, specifies that invalid server certificates that are detected will be automatically ignored. Set to NO by default. |
Timeout (seconds) |
Number |
No |
600 |
TIMEOUT="500" |
The total number of seconds allowed to connect to the SharePoint server before a timeout error is generated. The default value is 600 seconds. |
Proxy type |
Text (options) |
No |
Default |
|
The type of proxy required for SharePoint connections that pass through a proxy server. The available options are:
|
Use authentication |
--- |
--- |
--- |
--- |
If enabled, specifies that proxy authentication is required, enabling authentication-based parameters (disabled by default). This is a design-time parameter, therefore, contains no properties or markups. It is active only if the Proxy type parameter is set to HTTP. |
Proxy server |
Text |
No |
(Empty) |
PROXYSERVER="proxy.host.com" |
The host name (server.domain.com) or IP address (xxx.xxx.xxx.xxx) of the proxy server. This parameter is available only if the Proxy type parameter is set to HTTP. |
Proxy username |
Text |
No |
(Empty) |
PROXYUSERNAME=username |
The proxy username to authenticate with. This parameter is available only if the Use Authentication parameter is enabled. |
Proxy password |
Text |
No |
(Empty) |
PROXYPASSWORD="encrypted" |
The proxy password to authenticate with. This parameter is available only if the Use Authentication parameter is enabled. |
Proxy port |
Number |
No |
8080 |
PROXYPORT="8080" |
The port that should be used to connect to the proxy server. This parameter is available only if the Proxy type parameter is set to HTTP. The default value is 8080. |
Workflow Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
Workflow scope |
Text (options) |
Yes |
(Empty) |
SCOPE="id" |
Determines the scope with which workflow instances to be retrieved are associated. The available options are:
|
List title |
Text |
Yes if Workflow Scope is set to List |
(Empty) |
LIST="myList" |
The title of the list in which workflow instances will be retrieved. This parameter is active only if the Workflow scope parameter is set to List . |
Item ID |
Number |
Yes if Workflow Scope is set to List |
(Empty) |
ITEMID="12" |
The integer that identifies the item in a list. f the item in a list. This parameter is active only if theWorkflow scopeparameter is set toList. NOTE : The item ID is not the same as the index of the item in the collection of list items. This property contains the item's 1-based integer ID, which is one greater than the ID of the item that was previously added. |
Workflow ID |
Text |
Yes if Workflow Scope is set to List |
(Empty) |
WORKFLOWID="theID" |
The unique ID of the workflow from which workflow instances will be retrieved. This parameter is active only if the Workflow scope parameter is set to ID . |
Create and populate dataset with SharePoint workflow instance information |
Text |
Yes |
(Empty) |
RESULTDATASET="theData" |
The name of the dataset to create and populate with information regarding workflow instances that are retrieved. For more details, see Datasets below. |
Datasets
A dataset is a multiple column, multiple row container object where every column represents a particular variable, and each row corresponds to a given member of the dataset in question. This activity creates and populates a dataset containing specific fields (rows) in addition to the standard dataset fields. The table below describes these fields (assuming the dataset name assigned was theDataset).
Name |
Type |
Return Value |
---|---|---|
theDataset.LastUpdated |
Date |
The date and time the workflow instance was last updated. The returned date format matches the following: MM/DD/YYYY HH:MM:SS AM/PM. |
theDataset.ID |
Text |
The unique ID of the workflow instance (e.g., 82076e3e-3541-496b-bec1-02164a617b3). |
theDataset.InstanceCreated |
Date |
The date the instance was initially created. The returned date format matches the following: MM/DD/YYYY HH:MM:SS AM/PM. |
theDataset.Status |
Text |
The current status of the instance (e.g., Completed). |
theDataset.WorkflowName |
Text |
The unique name of the workflow that the workflow instance belongs to. |
Example
The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.
Description: This sample task retrieves information about existing workflow instances and populates a dataset with results. The dataset is then looped. During each iteration, the message dialog display information about the current workflow instance.
This sample is for AML viewing purposes only. In order for the task to work, it must be modified to fit your SharePoint credentials.
<AMVARIABLE NAME="siteWorkflowName" VALUE="MySiteWFD" /> <AMVARIABLE NAME="siteWorkflowInstanceID" /> <AMSHAREPOINT ACTIVITY="create_session" SITE="https://netauto.sharepoint.com/sites/test" VERSION="sharepointonline" USERNAME="pp@networkautomation.com" PASSWORD="AM4G1qhH0xfyvf1V0Fs9Zi/RNDVNgQZZ302aME" SESSION="SharePointSession1" /> <AMSHAREPOINT ACTIVITY="get_workflowinstances" SESSION="SharePointSession1" RESULTDATASET="theDataset" /> <AMSHOWDIALOG>Workflow instance ID: %theDataset.ID% Workflow instance created: %theDataset.InstanceCreated% Workflow instance last updated: %theDataset.LastUpdated% Workflow instance status: %theDataset.Status% Workflow name: %theDataset.WorkflowName% </AMSHOWDIALOG><AMSHAREPOINT ACTIVITY="end_session" SESSION="SharePointSession1" />