SharePoint - End session

Declaration

<AMSHAREPOINT ACTIVITY="end_session" SESSION="text" />

Related Topics

Description

Ends a SharePoint session created by the SharePoint - Create session activity.

NOTE: SharePoint-related error messages appearing in Automate Desktop are sent from your SharePoint site or server. Automate Desktop displays these messages verbatim. For information on SharePoint error messages, refer to Microsoft's SharePoint documentation.

Practical usage

Links SharePoint operations to a specific session. Use this activity at the end of a task to end a specific session after all operations complete.

Parameters

Connection

Property Type Required Default Markup Description
Session Text Yes SharePointSession1 SESSION="mySession1" The session name to end. Multiple sessions can exist within a single task, allowing simultaneous automation for several SharePoint operations.
NOTE: Create sessions with the SharePoint - Create session activity.

Description

Error Causes

On Error

Example

NOTE:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Description

This sample task demonstrates the use of sessions, as well as Automate Desktop's ability to start all workflows that exist in a given site. In this task, a SharePoint - Get workflow(s) activity retrieves the workflows from a particular site, and then creates and populates a dataset with results. The dataset is then looped. During each iteration, a SharePoint - Start workflow activity starts the next workflow on the list. In addition, each running workflow's instance ID is retrieved and written to a file for reporting or auditing purposes.

Copy
<AMVARIABLE NAME="siteWorkflowInstanceID" />
<AMSHAREPOINT ACTIVITY="create_session" SITE="https://netauto.sharepoint.com/sites/test" VERSION="sharepointonline" SPOAUTHTYPE="default" USERNAME="SharePoint_Master@networkautomation.com" PASSWORD="AM5BPKDgMcSp342JR/FIhIMHmKH7DY4yDU/+Vnj8KkDXJo=aME" SESSION="SPSession1" />
<AMSHAREPOINT ACTIVITY="get_workflows" SESSION="SPSession1" RESULTDATASET="siteWorkflowDataset" />
<AMLOOP ACTIVITY="dataset" DATASET="siteWorkflowDataset" />
<AMSHAREPOINT ACTIVITY="start_workflow" SESSION="SPSession1" WORKFLOWNAME="%siteWorkflowDataset.Name%" RESULTVARIABLE="siteWorkflowInstanceID" />
<AMFILESYSTEM ACTIVITY="write_file" FILE="c:\temp\execution_list">%siteWorkflowInstanceID%</AMFILESYSTEM>
<AMLOOP ACTIVITY="end" />
<AMSHAREPOINT ACTIVITY="end_session" SESSION="SPSession1" />