ExportDocuments
Exports one or more documents to the Vault File Staging Server.
Stored Procedure-Specific Information
Rather than passing a list of Ids, the DocumentList input takes the name of a temporary (#TEMP) table that holds the document Ids to export, one per row. This lets you build the export set with an ordinary query and then hand the whole set to the procedure in a single call.Documents are exported asynchronously in batches (up to 500 per job); larger tables are split into multiple jobs automatically. The operation waits for the export jobs to finish and returns the File Staging path of each exported file. The exported content (source files, renditions, and extracted document text, according to the input flags) is placed on the File Staging Server, where it can be retrieved.
Populating the DocumentList Temporary Table
A temporary table is a connection-scoped table whose name ends in #TEMP. You do not create it explicitly: the first INSERT INTO that uses the #TEMP name brings the table into existence, and each subsequent INSERT adds more rows. Temporary tables last only as long as the current connection is open and are discarded when the connection is closed.
The recommended way to populate the table is an INSERT INTO SELECT query that reads the Ids directly from the Documents table. An INSERT INTO SELECT selects a group of records from one table and inserts them into another as a single batch, which performs better than issuing many individual INSERT statements:
INSERT INTO DocumentList#TEMP (Id) SELECT id FROM Documents
The column list in parentheses maps each selected value into the temporary table: here the id column of the Documents table is written into the Id column of DocumentList#TEMP. Add a WHERE clause to the SELECT to control exactly which documents are included. You can also add rows one at a time with INSERT INTO ... VALUES:
INSERT INTO DocumentList#TEMP (Id) VALUES ('534')
INSERT INTO DocumentList#TEMP (Id) VALUES ('535')
Once the temporary table is populated, pass its name to the procedure through the DocumentList input:
EXEC ExportDocuments DocumentList = 'DocumentList#TEMP', Source = 'true', Renditions = 'false'
DocumentList Temporary Table Schema
| Column Name | Type | Required | Description |
| Id | String | True | The Id of a document to export. Populate it from the id column of the Documents table. |
Input
| Name | Type | Required | Description |
| DocumentList | String | True | The list of documents to export. The value must be a temporary table (#TEMP) containing an 'Id' column whose values are the document ids to export. Documents are exported in batches of up to 500; larger lists are split into multiple jobs automatically. |
| Source | String | False | Specifies whether to include the source file of each document. Defaults to true. |
| Renditions | String | False | Specifies whether to include the renditions of each document. Defaults to false. |
| AllVersions | String | False | Specifies whether to export all versions of each document instead of only the latest version. Defaults to false. |
| IncludeText | String | False | Specifies whether to include the extracted document text file for each exported version. Defaults to false. |
| ExportTimeout | String | False | The maximum number of seconds the entire operation may run, covering job submission, waiting for the export jobs, and retrieving results. Defaults to 3600. Set to 0 to run without a time limit. |
| PollInterval | String | False | The number of seconds to wait between export job status checks. Defaults to 15. Values below the Vault minimum of 10 seconds are raised to 10. |
Result Set Columns
| Name | Type | Description |
| Success | String | Indicates whether the document version was exported successfully. |
| JobId | String | The identifier of the export job that produced this row. |
| DocumentId | String | The Id of the exported document. |
| MajorVersionNumber | String | The major version number of the exported document version. |
| MinorVersionNumber | String | The minor version number of the exported document version. |
| File | String | The path on the Vault File Staging Server where the exported file resides. Retrieve the file from File Staging to download it. |
| UserId | String | The Id of the user who initiated the export job. |