sf_download_attachment {salesforcer} | R Documentation |
Download an Attachment
Description
This function will allow you to download an attachment to disk based on the attachment body, file name, and path.
Usage
sf_download_attachment(
body,
name = NULL,
sf_id = NULL,
object_name = c("Attachment", "Document"),
path = "."
)
Arguments
body |
|
name |
|
sf_id |
|
object_name |
|
path |
|
Value
character
; invisibly return the file path of the downloaded
content
Salesforce Documentation
See Also
Other Attachment functions:
check_and_encode_files()
,
sf_create_attachment()
,
sf_delete_attachment()
,
sf_update_attachment()
Examples
## Not run:
# downloading all attachments for a Parent record
# if your attachment name doesn't include the extension, then you can use the
# ContentType column to append it to the Name, if needed
queried_attachments <- sf_query("SELECT Id, Body, Name, ContentType
FROM Attachment
WHERE ParentId = '0016A0000035mJ5'")
mapply(sf_download_attachment, queried_attachments$Body, queried_attachments$Name)
# downloading an attachment by its Id
# (the file name will be the same as it exists in Salesforce)
sf_download_attachment(sf_id = queried_attachments$Id[1])
## End(Not run)