UploadContentDocument
Uploads a document to Salesforce Content and associates it with relevant records.
ストアドプロシージャ固有の情報
単一のファイルまたは単一のフォルダのアップロード
単一のコンテンツドキュメントをアップロードするには、FullPath を指定します。EXEC UploadContentDocument FullPath = 'C:\\csv samples\\mycsvfile.csv'単一のフォルダ内のすべてのコンテンツドキュメントをアップロードするには、FolderPath を指定します。
EXEC UploadContentDocument FolderPath = 'C:\\csv samples'Base64 データの場合は、Base64Data、Title、および FileExtension を指定する必要があります。
EXEC UploadContentDocument Base64Data = 'byBib2Jl', Title = 't', FileExtension = 'txt'
複数値の入力のアップロード
一時 (#TEMP) テーブルを使用してファイルパスから複数のコンテンツドキュメントをアップロードするには:- まず、一時テーブルに値を挿入します。例えば:
INSERT INTO ContentDocument#TEMP (FullPath) VALUES ('C:\Documents\proposal.docx') INSERT INTO ContentDocument#TEMP (FullPath, Description) VALUES ('C:\Documents\contract.pdf', 'Signed contract')これにより、値がメモリ内のテーブルに挿入されます。 - 次に、ストアドプロシージャを実行する際に同じテーブルを参照します。
EXEC UploadContentDocument ContentDocuments = 'ContentDocument#TEMP'
注: #TEMP テーブルを使用して複数の FolderPath を指定したり、複数の Base64 データエントリを使用したりすることもできます。
次の例は、JSON 配列を使用して複数のファイルまたはフォルダをアップロードする方法を示しています。
ファイルパスまたは Base64 データを使用して複数のコンテンツドキュメントをアップロードするには:
EXEC UploadContentDocument ContentDocuments = '[
{"FullPath": "C:\\Documents\\proposal.docx"},
{"FullPath": "C:\\Documents\\contract.pdf", "Title": "Q1 Contract", "Description": "Signed contract"},
{"Base64Data": "SGVsbG8gV29ybGQ=", "Title": "greeting", "FileExtension": "txt"}
]
異なるフォルダから複数のコンテンツドキュメントをアップロードするには:
EXEC UploadContentDocument ContentDocuments = '[
{"FolderPath": "C:\\Reports"},
{"FolderPath": "C:\\Invoices"}
]'
Input
| Name | Type | Description |
| FullPath | String | The full local path to the file to upload. Required if Base64Data is not provided. Only one of FullPath or FolderPath should be specified for a single operation. |
| Base64Data | String | Base64-encoded string representing the contents of the file. Required if FullPath is not specified. Useful for programmatic uploads without local file access. |
| FileExtension | String | The file extension that indicates the content type (such as PDF, TXT, or DOCX). Required when using Base64Data to define the file contents. |
| Title | String | The title to assign to the ContentDocument in Salesforce. If omitted, the file name from FullPath will be used. Required when uploading using Base64Data. |
| FolderPath | String | Path to a local folder containing multiple files to upload in batch. Only one of FolderPath or FullPath should be used per request. |
| Description | String | Optional text description for the ContentDocument. Maximum length is 255 characters. |
| LinkedObjectId | String | The ID of the Salesforce record to associate all uploaded files with. When specified, each uploaded file will be linked to this record via a ContentDocumentLink. Can also be set per file using the ObjectId column in the ContentDocuments aggregate. |
| ContentDocuments | String | Accepts a temporary table name or an aggregate (JSON) containing multiple ContentDocument records for batch uploading. Each row should contain fields such as FullPath or Base64Data. |
Result Set Columns
| Name | Type | Description |
| Id | String | The ID of the newly created content version record associated with the uploaded document. |
| ContentDocumentId | String | The ID of the ContentDocument object created from the uploaded file. |
| FileIdentifier | String | Identifies the file for this result row. Contains the full file path when FullPath or FolderPath was used, or the title when Base64Data or Content stream was used. |
| Success | Boolean | Indicates whether the file upload succeeded (true) or failed (false). |
| Errors | String | Error messages returned by Salesforce if the upload failed, including error codes and descriptions. |