UploadDocument
Salesforce にドキュメントをアップロードし、ドキュメントリポジトリで利用可能にします。
Stored Procedure-Specific Information
This stored procedure uploads a Document to a Salesforce folder.Examples
Upload document to folder:
EXEC UploadDocument FolderId = '00l5Y000004PPvnQAG', Name = 'testfile.txt'
Upload document with file path:
EXEC UploadDocument FolderId = '00l5Y000004PPvnQAG', FullPath = 'C:\Documents\testfile.txt'
Parameters:
- FolderId - The ID of the Salesforce folder to upload the document to (required)
- Name - The name for the uploaded document
- FullPath - The full path to the file to upload
Output columns include:
- Id - The ID of the created document
Uploading Single Files or Single Folders
To upload a single document, specify the FullPath:EXEC UploadDocument FolderId = '0018Z00002nz4TkMAR', FullPath = 'C:\csv samples\mycsvfile.csv'To upload all documents in a single folder, use FolderPath:
EXEC UploadDocument FolderId = '0018Z00002nz4TkMAR', FolderPath = 'C:\\csv samples'For Base64 data, you need to specify Base64Data, Title, and FileExtension:
EXEC UploadDocument FolderId = '0018Z00002nz4TkMAR', Base64Data = 'byBib2Jl', Title = 't', FileExtension = 'txt'
Uploading Multi-Valued Inputs
There are several ways to upload multiple files or folders.Using a temporary table, #TEMP:
- First insert values into temporary tables. For example:
INSERT INTO Document#TEMP (FolderId, FolderPath) VALUES ( '0018Z00002nz4TkMAR', 'C:\\TestImages' ) INSERT INTO Document#TEMP (FolderId, FolderPath) VALUES ('0018Z00002nz4TkMAR', 'C:\\csv samples' )This inserts the values into a table in memory. - Then reference that same table when executing the stored procedure:
EXEC UploadDocument Documents = 'Document#TEMP'
This approach has the advantage of avoiding arbitrary parameters as inputs to the stored procedure.
Input
| Name | Type | Accepts Input Streams | Description |
| FullPath | String | False | アップロードするドキュメントへの完全なローカルパス。Base64Data が提供されていない場合は必須です。アップロード操作ごとにFullPath またはFolderPath のいずれか1つのみを指定してください。 |
| Base64Data | String | False | ドキュメントの内容を表すBase64 エンコードされた文字列。FullPath が提供されていない場合は必須です。ローカルファイルパスに依存しないアップロードを可能にします。 |
| Name | String | False | Salesforce でドキュメントに割り当てる名前。指定されていない場合、FullPath からのファイル名が使用されます。Base64Data を使用してアップロードする場合は必須です。 |
| FolderId | String | False | ドキュメントが保存されるフォルダのID。この項目はすべてのアップロードに必須です。 |
| FolderPath | String | False | バッチでアップロードされるドキュメントを含むローカルフォルダへのパス。単一操作ではFolderPath またはFullPath のいずれか1つのみを指定してください。 |
| Description | String | False | ドキュメントのオプション説明。最大255文字に制限されています。 |
| Content | String | True | InputStream としてのファイルの内容。直接ストリーミングアップロードのためのFullPath またはBase64Data の代替として使用されます。 |
| Documents | String | False | 複数のDocument レコードをバッチでアップロードするための一時テーブル名またはJSON集計を受け入れます。各行にはFullPath、Base64Data、またはName などの入力が含まれている必要があります。 |
Result Set Columns
| Name | Type | Description |
| Id | String | Salesforce に正常にアップロードされたドキュメントのID。 |
| FileIdentifier | String | この結果行のファイルを識別します。FullPath またはFolderPath が使用された場合は完全なファイルパスを含み、Base64Data またはコンテンツストリームが使用された場合はファイル名を含みます。 |
| Success | Boolean | ファイルのアップロードが成功した(true)か失敗した(false)かを示します。 |
| Errors | String | アップロードが失敗した場合にSalesforce によって返されるエラーメッセージ。エラーコードと説明を含みます。 |