1

I have the need to let external user to download from salesforce without authenticate. In the sandbox I use the following url

https://{DOMAIN}/sfc/servlet.shepherd/version/download/{ContentVersionId}

and I am able to download the file without authenticate but in production salesforce require the authentication, apparently everything is the same. My question is: Is there some setting to change to give the external user the privilege to download the ContentVersion without authenticate using the above link?

Thank you in advance!

2 Answers 2

3

You can use Public Link Sharing when you go to your file :

enter image description here

And then create public link for your file :

enter image description here

Or if you need to automate this you can use ContentDistribution and DistributionPublicUrl.
Check link here : link .

ContentDistribution Represents information about sharing a document externally.

Here an example of code for this :

ContentDistribution cdl = new ContentDistribution();
cdl.ContentVersionId = '0680DXXX002RmxQAE';
cdl.Name = 'PublicShare';
insert cdl;
cdl = [SELECT DistributionPublicUrl FROM ContentDistribution WHERE Id = :cdl.Id LIMIT 1];
return cdl.DistributionPublicUrl;
2
  • 1
    Thank you for the help but I had to add some step prior to your solution, infact I already tried to make as you say but I needed to have the "Deliver Content" Permission
    – Giovanni
    Jan 31 at 19:17
  • @Giovanni you are welcome! Jan 31 at 19:21
0

Actually the complete answer is that I have to give the Admin User all the "Salesforce CRM Content" permission. To make this work I had to:

  1. Create a Permission Set to enable the "Salesforce CRM Content" user to the Admin
  2. Enable "Salesforce CRM Content" and assign all the privilege
  3. Assign to thee Library Permission associated to the Library in which the file is the privilege of "Deliver Content" via salesforce Classic under the "Content Permission" tab
  4. Insert the ContentDistribution record as reported by @Vitalii Dehnerys

Thank you for the help!

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.