ADO.NET Provider for Salesforce

Build 25.0.9434

DownloadAttachment

Downloads attachments related to a specific Salesforce entity.

Input

Name Type Accepts Output Streams Description
ObjectId String False ID of the Salesforce object (such as Account or Case) to which the attachment is related. Used to retrieve attachments associated with this object.
Id String False ID of the specific attachment to download. Required if Name is not provided. If both Id and Name are omitted, all attachments related to the ObjectId will be downloaded.
Name String False Filename of the attachment to download. Used as an alternative to Id when LightningMode is 'false'. If both Name and Id are omitted, all attachments for the ObjectId will be downloaded.
LocalPath String False Directory path on your local machine where the attachment will be saved. If not provided, the attachment will be returned in memory via FileData.
LightningMode String False Set to 'true' to download from the Lightning Experience 'Salesforce Files' system instead of Classic Attachments. Required if the file was uploaded using UploadAttachment with LightningMode enabled.
Encoding String False Character encoding used to return the file data in the FileData output. Applies only when the file is not saved to a local path.

The allowed values are NONE, BASE64.

The default value is BASE64.

FileStream String True Optional output stream for writing the file data if LocalPath is not specified. Used for in-memory or streaming scenarios.

Result Set Columns

Name Type Description
FileId String Salesforce ID of the downloaded file.
Success String Indicates whether the attachment was downloaded successfully (true) or not (false).
FileName String Name of the downloaded file, as stored in Salesforce.
FullPath String Full local path, including filename, where the attachment was saved. Returned only if LocalPath was specified.
FileData String Base64-encoded file content, returned only if the file was not saved to disk (LocalPath not specified).
FailureMessage String If multiple files were downloaded, this field includes error messages for any files that failed to download.

Copyright (c) 2025 CData Software, Inc. - All rights reserved.
Build 25.0.9434