DownloadDocumentFile
Retrieves and downloads the binary file associated with a specific document from the Vault. This procedure is commonly used in automation and integration workflows where access to the document's content is required.
Example:
EXEC DownloadDocumentFile DocumentId = '1234', DownloadLocation = 'C:/Users/Public/cover.png'
Note about LockDocument: The user who checked the document out and the Document Owner can check it back in. If the user or Document Owner is not available then a Vault Owner or Administrator must undo the checkout. Otherwise, the document cannot progress.
Input
| Name | Type | Required | Accepts Output Streams | Description |
| DocumentId | String | True | False | Required. The unique identifier of the document to be downloaded. This ID must reference an existing document in the Veeva Vault system. |
| DownloadLocation | String | False | False | Optional. A full local file path where the document will be saved upon download. If provided, the file will be written to this location (for example, C:/Users/Public/Desktop/document.docx). |
| FileStream | String | False | True | Optional. A writable stream instance to which the document's binary content will be sent. This is used when DownloadLocation is not specified, enabling in-memory handling of the file content. |
| LockDocument | String | False | False | Optional. If set to true, the system will Check Out the document before downloading it. This prevents other users from modifying the document while it is being accessed. |
Result Set Columns
| Name | Type | Description |
| Success | String | Boolean value indicating whether the download operation was successful. Returns true if the document was downloaded without errors, false otherwise. |
| FileData | String | Contains the file's binary content encoded in Base64 format. This field is only populated if both DownloadLocation and FileStream inputs are not specified, allowing file data to be retrieved directly in the output payload. |
| FileName | String | The name of the downloaded document file, including its extension, if returned by the system during the operation. |