1

Hi I'd like to download images of feed files. I know how to do it for Attachment in which I just have to run SOQL like "Select ID, BODY, NAME from ATTACHMENT where ...". by encoding and decoding the body, I'm able to download attachment.

I'm wondering how can I do it for Feed Attachments.

In SOAP API Developer guide it has an example

"SELECT Body, (SELECT RecordId, Title, Type, Value FROM FeedAttachments)
FROM FeedItem
WHERE Id = ..."

But I still can't get the Body of the attachment. Could you please help?

1 Answer 1

2

These are the following ways you can retrieve the attachment of feed items

"SELECT Body, (SELECT RecordId, Title, Type, Value FROM FeedAttachments) FROM FeedItem WHERE Id = ..."

Take RecordId from above SOQL and pass it as an Id of ContentVersion like this:

SELECT Title, Id, VersionData FROM ContentVersion Id =<RecordId>

The retrieved VersionData returns base64 encoded file data. You can convert it to blob by the use of EncodingUtil.base64Decode('<VersionData>')

For more information refer ContentVersion

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .