DownloadFile
Downloads an attachment from a CRM record to local storage.
Stored Procedure-Specific Information
This stored procedure supports downloading files from 'fileupload' and 'imageupload' fields. You can specify the download location using the DownloadPath parameter.
To execute this procedure, enter:
EXEC DownloadFile ModuleName = 'Contacts', RecordID = '100000000000000000', AttachmentID = '100000', DownloadPath='C:\\test.pdf';
You can also supply an instance of an output stream in the FileStream parameter.
When neither DownloadFile nor FileStream is supplied, the downloaded file is returned in the Content output parameter as a base64-encoded string.
Input
| Name | Type | Accepts Output Streams | Description |
| ModuleName | String | False | The API name of the module containing the record with the attachment to download. |
| RecordID | String | False | The unique identifier of the record from which to download the attachment. |
| AttachmentID | String | False | The unique identifier of the attachment to download. |
| DownloadPath | String | False | The file system path where the downloaded attachment is saved. |
| FileStream | String | True | An output stream to which the attachment data is written. Used only when the download path is not provided. |
Result Set Columns
| Name | Type | Description |
| Success | String | Indicates whether the download operation was successful. |
| Content | String | The Base64-encoded content of the downloaded file, returned when the download path is not specified. |