1

I am using content files to drive documentation about products in a lightning community.

I've researched the ContentDocument and ContentVersion documentation but I am unable to figure how to get either the base64 value of the document, or the direct download url. Pasting the URL in the browser renders XML that says invalid session.

On ContentVersion there is a VersionData field that says its the base64 value of the content, but querying for it only returns a URL.enter image description here

I've also followed this tutorial on displaying content files on a visual force page but, but it just takes you to the record page and not the document.

Has someone implemented something similar?

3
1

The direct download link for the file is of the form: sfBaseUrl + /sfc/servlet.shepherd/version/download/ + ContentVersionId

The query editor shows the URL for VersionData but in Apex it is the correct type.

7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.