DownloadDocument
Downloads a document from a SharePoint document library. Allows users to obtain offline copies or process documents externally.
Stored Procedure Specific Information
RemoteFile can be both relative to the library, or it can be the full URL of the file. Below are some examples:
EXECUTE DownloadDocument File = 'C:/Users/User/Desktop/DownloadedFile.txt', Library = 'Shared Documents', RemoteFile = 'https://mysite.sharepoint.com/Shared Documents/newFolder/FileToDownload.txt'; EXECUTE DownloadDocument File = 'C:/Users/User/Desktop/DownloadedFile.txt', Library = 'Shared Documents', RemoteFile = '/newFolder/FileToDownload.txt';
Input
| Name | Type | Required | Description |
| File | String | False | The local file path where the downloaded document will be saved, including the filename. For example, 'C:/Users/User/Desktop/DownloadedFile.txt'. |
| Library | String | False | The name of the document library on the SharePoint server from which the file will be downloaded. For example, 'Shared Documents'. |
| RemoteFile | String | True | The file’s relative path within the library or its full SharePoint URL. Determines the exact file to be retrieved. |
| Encoding | String | False | Specifies the character encoding format for the downloaded data. Determines how the data is read and processed.
The allowed values are NONE, BASE64. The default value is BASE64. |
| ReadTimeout | String | False | The maximum number of seconds allowed for the download operation. If exceeded, the operation fails, unlike Timeout, which only triggers if the download stalls. |
Result Set Columns
| Name | Type | Description |
| Success | Boolean | Indicates whether the document download operation was successful. Returns 'true' for success and 'false' for failure. |
| FileData | String | Contains the downloaded file content as binary data. Only returned if neither File nor FileStream is specified. |