DownloadAttachment
Downloads an attachment from a SharePoint list item. Useful for accessing and retrieving necessary documents.
Stored Procedure-Specific Information
To execute this procedure, enter:EXEC DownloadAttachment File = 'C:/Users/User/Desktop/DownloadAttachment.txt', RemoteFile = '/Lists/EnnioTest/Attachments/1/filename.txt'RemoteFile can be expressed either relative to the server, or as the full URL of the file.
Input
| Name | Type | Required | Accepts Output Streams | Description |
| File | String | False | False | The local file path where the downloaded attachment will be saved. If not specified, the file content may be returned in FileData or written to a stream. |
| RemoteFile | String | True | False | The path of the file on the SharePoint server. Can be a full URL or just the file name. If only the name is provided, the latest version is downloaded. |
| Encoding | String | False | 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. |
| FileStream | String | False | True | The output stream to which the downloaded attachment will be written. Used if File is not provided. |
| ReadTimeout | String | False | 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 attachment 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. |