Automating SharePoint Downloads in 3 Easy Steps

January 26, 2018

Microsoft SharePoint collaboration software is one of the more powerful tools for companies that need enterprise-scale solutions to mange content, administer business processes, and streamline how people find and share information across the network. The SharePoint system is composed of a full range of applications and tools that allow document management, workflow design, and collaboration. SharePoint helps teams stay connected and productive by providing easy access to the people, documents and information that can help in decision making and getting work done.  

With the use of Automate's SharePoint automation activities, organizations have the power to automate the creation, management, and implementation of SharePoint sites that are discoverable throughout the organization. By further streamlining and automating SharePoint processes, a company's resources can be allocated to other areas, which can lead to reduced costs and greater operational efficiency. 

Automate and SharePoint

In this article, we will explore how you can use Automate to download a single file (document) stored in a “Shared Documents” library of SharePoint.

Step 1

Drag the SharePoint action and select “Create Session” activity. You will need to provide the SharePoint site URL and the proper credentials to connect to the SharePoint server. Optionally, the HTTP proxy settings can also be provided.

Automate SharePoint Actions

Step 2

Drag the SharePoint action and select the “Download file” activity. In order to download a specific file, you need to provide the server relative URL. In the example below, the URL site is http://server/my/personal/Team, so the server relative URL would be: /my/personal/Team/ Library Name/File Name (/my/personal/Team/Shared Documents/Data.txt). If you have a sub folder inside the library, the URL would look something like this: /my/personal/Team/Library Name/Sub Folder Name/ File Name (/my/personal/Team/Shared Documents/Dev/Log.txt).

SharePoint Download Automation

Step 3

Drag the SharePoint action and select “End session” activity.


   <AMSHAREPOINT ACTIVITY="create_session" SITE="http://server/my/personal/Team" AUTHTYPE="Basic" USERNAME="administrator" PASSWORD="password" DOMAIN="winserv08r2" />

   <AMSHAREPOINT URL="/my/personal/Team/Shared Documents/Data.txt" DESTINATION="C:\Logs\data.txt" PROVIDER="session_based" />

   <AMSHAREPOINT ACTIVITY="end_session" />

You can also provide the same server setting in the “Download file” activity and achieve the same result with one step. We recommend that you use session when you need to perform multiple transactions with the SharePoint server.

How to Download All Files from the “Shared Documents” Library

Use the SharePoint activity “Get files” to get the dataset of all the files available in the “Shared Documents” library. Then loop through that dataset and use dataset fields FileRef and FileLeafRef to download one file at a time.

FileRef: provides server relative URL of the file

FileLeafRef: provides the file name

The default query provided in the “Get file” activity will retrieve all the files within the library recursively.


  <AMSHAREPOINT ACTIVITY="create_session" SITE="http://server/my/personal/Team" AUTHTYPE="Basic" USERNAME="administrator" PASSWORD="password" DOMAIN="winserv08r2" />

  <AMSHAREPOINT ACTIVITY="get_files" LIBRARY="Shared Documents" RESULTDATASET="test" PROVIDER="session_based" />


  <AMSHAREPOINT URL="%test.FileRef%" DESTINATION="C:\Logs\%test.FileLeafRef%" OVERWRITE="yes" PROVIDER="session_based" />


  <AMSHAREPOINT ACTIVITY="end_session" />

Get Started

See for yourself how Automate can streamline SharePoint tasks and other business processes with a personalized software demonstration from our experts.