UploadContentDocument
Uploads a content document in Salesforce.
Uploading single files or single folders
To upload a single ContentDocument, specify the FullPath:EXEC UploadContentDocument FullPath = 'C:\\csv samples\\mycsvfile.csv'To upload all Content Documents in a single folder, use FolderPath:
EXEC UploadContentDocument FolderPath = 'C:\\csv samples'For Base64 data, you need to specify the Base64Data, Title, and FileExtension:
EXEC UploadContentDocument Base64Data = 'byBib2Jl', Title = 't', FileExtension = 'txt'
Uploading multi-valued inputs
There are various ways to upload multiple files or folders. One way is to use a temporary table, #TEMP: First insert values into temporary tables. For example:INSERT INTO ContentDocument#TEMP (FolderPath) VALUES ('C:\\TestImages')
INSERT INTO ContentDocument#TEMP (FolderPath) VALUES ('C:\\csv samples')
This inserts the values into a table in memory.
Then reference that same table when executing the stored procedure:
EXEC UploadContentDocument ContentDocumentTempTable = 'ContentDocument#TEMP'This approach has the advantage of avoiding arbitrary parameters as inputs to the stored procedure. Alternatively, you can specify multiple FullPaths using a #TEMP table or use multiple Base64 data entries.
Input
| Name | Type | Accepts Input Streams | Description |
| FullPath# | String | False | The full path to the file to upload. If Base64Data is not specified, this input is required. Either specify this or FullPath/FolderPath for a single object and not both. |
| Base64Data# | String | False | A string of data that will be used as the full contents of the file. This must be base-64 encoded. Required if FullPath is not specified. |
| FileExtension# | String | False | Type of content. Required if Base64Data is specified. |
| Title# | String | False | The title you would like to give the content document. If none is specified, the file name specified in the FullPath will be used. Required if Base64Data is specified. |
| FolderPath# | String | False | Used to batch upload every file inside a specified folder. Either specify this or FullPath for a single object and not both. |
| Description# | String | False | Text description of the ContentDocument. Limit: 255 characters. |
| Content | String | True | The file content as an InputStream. Only used if FullPath is empty. |
| ContentDocumentTempTable | String | False | Used to batch upload multiple ContentDocument objects. Set this to a temporary table, whose rows contain upload inputs like in the example below. |
Result Set Columns
| Name | Type | Description |
| Id | String | The Id of the uploaded content version. |
| ContentDocumentId | String | The Id of the content document. |