/
Download Files from Salesforce Attachments
Download Files from Salesforce Attachments
You can query the Attachment Body field, which will be exposed in .NET as a byte[].
SalesforceSession session = //... AttachmentService attachmentService = new AttachmentService(session); // Id might be via a relationship field or Attachment might come from a sub query. Id attachmentId = new Id("00P9000000vVgYq"); Attachment attachment = attachmentService.GetByEntityId(attachmentId, new SObjectField[] { Attachment.Fields.Id, Attachment.Fields.Body, Attachment.Fields.BodyLength, Attachment.Fields.Name, Attachment.Fields.ContentType }); Assert.IsNotNull(attachment); Assert.AreEqual("image/png", attachment.ContentType); byte[] attachmentBody = attachment.Body; Assert.AreEqual(attachment.BodyLength, attachmentBody.Length); using (Image pngImage = Image.FromStream(new MemoryStream(attachmentBody))) { pngImage.Save(attachment.Name, ImageFormat.Png); }
, multiple selections available,
Related content
Attaching Files to a Salesforce Record
Attaching Files to a Salesforce Record
More like this
Adding Attachments to a Salesforce Record
Adding Attachments to a Salesforce Record
More like this
Upload Files to Salesforce Documents
Upload Files to Salesforce Documents
More like this
Downloader Documentation
Downloader Documentation
More like this
Creating Chatter Records with an Attachment
Creating Chatter Records with an Attachment
More like this
Add a new HTTP/S download
Add a new HTTP/S download
More like this