UploadContentDocument
Salesforce Content にドキュメントをアップロードし、関連レコードに関連付けます。
Stored Procedure-Specific Information
This stored procedure uploads a ContentDocument (Salesforce Files) to Salesforce.Examples
To upload a content document (test_UploadDocumentContent_stream):
EXEC UploadContentDocument Title = 'testing', FileExtension = 'txt'To upload content document with file path:
EXEC UploadContentDocument FullPath = 'C:\Documents\myfile.pdf'To upload content document with Base64 data:
EXEC UploadContentDocument Base64Data = 'byBib2Jl', Title = 'mydocument', FileExtension = 'txt'
Parameters:
- Title - The title for the uploaded content document
- FileExtension - The file extension (e.g., 'txt', 'pdf', 'png')
- FullPath - The full path to the file to upload
- Base64Data - Base64-encoded file content
Output columns include:
- Id - The ID of the created ContentDocument
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 must specify the Base64Data, Title, and FileExtension:
EXEC UploadContentDocument Base64Data = 'byBib2Jl', Title = 't', FileExtension = 'txt'
Uploading Multi-Valued Inputs
There are several 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 ContentDocuments = 'ContentDocument#TEMP'This approach has the advantage of avoiding arbitrary parameters as inputs to the stored procedure.
You can also specify multiple FullPaths using a #TEMP table or use multiple Base64 data entries.
Input
| Name | Type | Description |
| FullPath | String | アップロードするファイルへの完全なローカルパス。Base64Data が提供されていない場合は必須です。単一操作ではFullPath またはFolderPath のいずれか1つのみを指定してください。 |
| Base64Data | String | ファイルの内容を表すBase64 エンコードされた文字列。FullPath が指定されていない場合は必須です。ローカルファイルアクセスなしのプログラムアップロードに有用です。 |
| FileExtension | String | コンテンツタイプを示すファイル拡張子(PDF、TXT、DOCX など)。Base64Data を使用してファイル内容を定義する場合は必須です。 |
| Title | String | Salesforce のContentDocument に割り当てるタイトル。省略された場合、FullPath のファイル名が使用されます。Base64Data を使用してアップロードする場合は必須です。 |
| FolderPath | String | バッチで複数のファイルをアップロードするローカルフォルダへのパス。リクエストごとにFolderPath またはFullPath のいずれか1つのみを使用してください。 |
| Description | String | ContentDocument のオプションテキスト説明。最大長は255文字です。 |
| LinkedObjectId | String | アップロードされたすべてのファイルを関連付けるSalesforce レコードのID。指定された場合、各アップロードファイルはContentDocumentLink を通じてこのレコードにリンクされます。ContentDocuments 集計のObjectId 列を使用してファイルごとに設定することもできます。 |
| ContentDocuments | String | 複数のContentDocument レコードをバッチでアップロードするための一時テーブル名またはJSON集計を受け入れます。各行にはFullPath またはBase64Data などの項目が含まれている必要があります。 |
Result Set Columns
| Name | Type | Description |
| Id | String | アップロードされたドキュメントに関連付けられた、新しく作成されたコンテンツバージョンレコードのID。 |
| ContentDocumentId | String | アップロードされたファイルから作成されたContentDocument オブジェクトのID。 |
| FileIdentifier | String | この結果行のファイルを識別します。FullPath またはFolderPath が使用された場合は完全なファイルパスを含み、Base64Data またはコンテンツストリームが使用された場合はタイトルを含みます。 |
| Success | Boolean | ファイルのアップロードが成功した(true)か失敗した(false)かを示します。 |
| Errors | String | アップロードが失敗した場合にSalesforce によって返されるエラーメッセージ。エラーコードと説明を含みます。 |