JDBC Driver for Salesforce

Build 26.0.9770

DownloadDocument

Downloads documents from Salesforce for offline access or external use.

ストアドプロシージャ固有の情報

このストアドプロシージャは、Documents オブジェクト(ContentDocument/Salesforce Files ではない)から Salesforce のドキュメントをダウンロードします。

以降のサブセクションでは、例を示します。これらの例の出力カラムには、次のものが含まれます。

  • Success:ダウンロードが成功したかどうか。
  • FileId:ダウンロードしたドキュメントの ID。
  • FileData:ファイルの内容(デフォルトでは Base64 エンコード)。
  • FileName:ファイルの名前(ディスクに保存する場合)。
  • FullPath:ファイルが保存された完全なパス(ディスクに保存する場合)。

ドキュメント ID でダウンロード

ドキュメントを ID でダウンロードするには:
EXEC DownloadDocument Id = '0151W000002kJtPQAU'

特定のファイルパスにダウンロード

ドキュメントをダウンロードして特定の場所に保存するには:
EXEC DownloadDocument Id = '0151W000002kJtPQAU', FullPath = 'C:\\Downloads\\mydocument.pdf'

Base64 データとしてダウンロード

デフォルトでは、ファイルの内容は FileData 出力カラムに Base64 エンコードされたデータとして返されます。生の(エンコードされていない)内容を取得するには、Encoding パラメータを設定します:
EXEC DownloadDocument Id = '0151W000002kJtPQAU', Encoding = 'NONE'

Input

Name Type Accepts Output Streams Description
Id String False Salesforce ID of the specific document to download. Required if Name or FolderId is not specified. If none are provided, all documents will be downloaded.
Name String False Name of the document to download. Can be used as an alternative to Id or FolderId. If none are provided, all documents will be downloaded.
Folderid String False Salesforce ID of the folder containing the documents to download. Useful for downloading all documents within a specific folder.
LocalPath String False Path on the local file system where the downloaded file(s) will be saved. If omitted, the file is returned in memory via the FileData output.
Encoding String False Text encoding format used when returning file data via FileData. Ignored if the file is written to disk.

The allowed values are NONE, BASE64.

The default value is BASE64.

FileStream String True Optional output stream to write file data to when LocalPath is not specified. Supports in-memory or streaming download use cases.

Result Set Columns

Name Type Description
FileId String Salesforce ID of the downloaded document.
Success String Indicates whether the download operation succeeded for the specific document (true or false).
FileName String Name of the file that was downloaded from Salesforce.
FullPath String Complete local file path, including the file name, where the document was saved.
FileData String Base64-encoded content of the downloaded file. Only returned when LocalPath is not set and data is kept in memory.
FailureMessage String If downloading multiple documents, contains error messages for any documents that failed to download.

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 26.0.9770