+ Start a Discussion
Pierce Hale 15Pierce Hale 15 

Where is the public link stored for ContentDocuments? Is there a way to query this value?

Best Answer chosen by Pierce Hale 15
vijay kumar kvijay kumar k
Hi Pierce

Greetings to you,

All content document public links are got stored in ContentDistribution Object.
For object reference: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdistribution.htm
Yes pierce, you can query public url from content distribution object with help of ContentDocumentID or ContentVersionId.

Ex : Select Id,ContentDocumentId,ContentDownloadUrl,DistributionPublicUrl from ContentDistribution where ContentDocumentId='0691000000FOq3nAAD'

I hope this is helpful to you. Please mark this as the best answer if it's useful to you.

Regards
Vijay

All Answers

karthikeyan perumalkarthikeyan perumal
Hello, 

Spring 19' update there is a new setting in the "App Permission -> Content -> Query All Files: Allows View All Data users to SOQL query all files in the org".
This is not enabled by default for the admin user but you can at least enable it in a Profile/Permissions Set.

Document:

https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contentversion.htm

you should query something like this: 
 
SELECT ContentDocumentId,LinkedEntityId,ContentDocument.Title, ContentDocument.ContentModifiedDate, ContentDocument.ContentSize FROM ContentDocumentLink WHERE LinkedEntityId = '00655000007PiSd'

hope this will hleps you.

Thanks
karthik
 
vijay kumar kvijay kumar k
Hi Pierce

Greetings to you,

All content document public links are got stored in ContentDistribution Object.
For object reference: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdistribution.htm
Yes pierce, you can query public url from content distribution object with help of ContentDocumentID or ContentVersionId.

Ex : Select Id,ContentDocumentId,ContentDownloadUrl,DistributionPublicUrl from ContentDistribution where ContentDocumentId='0691000000FOq3nAAD'

I hope this is helpful to you. Please mark this as the best answer if it's useful to you.

Regards
Vijay
This was selected as the best answer
Pierce Hale 15Pierce Hale 15
Thanks both!  I see that you have to specify the ContentDocumentId which is interesting.  I'll need to spend some time looking at the ContentVersion, ContentDocumentLink and ContentDocument relationships as it's still a little confusing, but this context helps greatly!!!  Thanks!
roshif caferoshif cafe

When we’re accomplishing something particularly on the PC we additionally need it to be saved it in…

https://www-nbiclearancecom.com/
lottery sambadlottery sambad
This is one of the best ways to double your money as the lottery Sambad (https://www.minds.com/lotterysambadtoday/blog/nagaland-state-lottery-results-dear-honesty-morning-11-55-am-1048475782100951040) scheme works perfectly for various people who play the character of this Indian SattaKing Result. Even some lottery company, it is one of the names of the lottery of country-wise, abusive, Mumbai and Kalyan Satta-King.
karthikeyan perumalkarthikeyan perumal
Hello Roshif cafe, lottery sambad, 

kinldy market your product  somewhere else. this is not the right platform. its Q&A form for salesforce CRM developers. kinldy understand that. remove your  ads from here. i already flagged you people. 

Thanks
karthik