UploadContentDocument
Salesforce Content にドキュメントをアップロードし、関連レコードに関連付けます。
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 ContentDocuments = '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 | アップロードするファイルへの完全なローカルパス。Base64Data が提供されていない場合は必須です。単一操作ではFullPath またはFolderPath のいずれか1つのみを指定してください。 |
| Base64Data | String | False | ファイルの内容を表すBase64 エンコードされた文字列。FullPath が指定されていない場合は必須です。ローカルファイルアクセスなしのプログラムアップロードに有用です。 |
| FileExtension | String | False | コンテンツタイプを示すファイル拡張子(PDF、TXT、DOCX など)。Base64Data を使用してファイル内容を定義する場合は必須です。 |
| Title | String | False | Salesforce のContentDocument に割り当てるタイトル。省略された場合、FullPath のファイル名が使用されます。Base64Data を使用してアップロードする場合は必須です。 |
| FolderPath | String | False | バッチで複数のファイルをアップロードするローカルフォルダへのパス。リクエストごとにFolderPath またはFullPath のいずれか1つのみを使用してください。 |
| Description | String | False | ContentDocument のオプションテキスト説明。最大長は255文字です。 |
| LinkedObjectId | String | False | アップロードされたすべてのファイルを関連付けるSalesforce レコードのID。指定された場合、各アップロードファイルはContentDocumentLink を通じてこのレコードにリンクされます。ContentDocuments 集計のObjectId 列を使用してファイルごとに設定することもできます。 |
| Content | String | True | InputStream としてのファイルの内容。直接ストリーミングアップロードのためのFullPath またはBase64Data の代替として使用されます。 |
| ContentDocuments | String | False | 複数の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 によって返されるエラーメッセージ。エラーコードと説明を含みます。 |