function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nwallacenwallace 

Content Document/Version Downloading

Hi,

 

A client is hosting documents (about 50) as Content Documents on Salesforce that need to be accessible for download from a Visualforce page.

 

Right now, the VF page is creating a link of the format:

    https://<SERVER>.salesforce.com/sfc/servlet.shepherd/version/download/<CONTENT VERSION ID>

 

This link returns a page that causes the file to download automatically (via "Content-disposition: attachment" in the HTTP header).  This solution, while preferable in most situations, is not possible for mine.  Our documents are PDFs and they need to open in the browser (reasons are complicated -- just trust me, there is no negotiating this point).

 

So what I need to know, is there any way to dynamically get a link to the actual file of a Content Version, rather than this Content delivery servlet link?

 

Thanks!

vamsi@sfmobilevamsi@sfmobile

Hi i was trying to download the attachment for content document which is text file.. I used the url https://c.ap1.content.force.com/sfc/servlet.shepherd/version/download/06890000000CZjT

just the way u suggested and while downloading the below content is present in downloaded text file instead of its actual content. I think this occurs if i m not authorized to access the content. But i specified http headers for authorization and Content-disposition. But i could not download the actual file. Any pointers or any other way to download the salesforce content document is really helpful

 

Thanks,

Vamsi.

 

<script>
if (window.location.replace){
window.location.replace('https://login.salesforce.com/?ec=302&startURL=%2Fcontent%2Fsession%3Furl%3Dhttps%253A%252F%252Fc.ap1.content.force.com%252Fsfc%252Fservlet.shepherd%252Fversion%252Fdownload%252F06890000000CZjT');
} else {;
window.location.href ='https://login.salesforce.com/?ec=302&startURL=%2Fcontent%2Fsession%3Furl%3Dhttps%253A%252F%252Fc.ap1.content.force.com%252Fsfc%252Fservlet.shepherd%252Fversion%252Fdownload%252F06890000000CZjT';
}
</script>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">






</head>


</html>



<!--
...................................................................................................
...................................................................................................
...................................................................................................
...................................................................................................
-->