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
Vinnie Bacon 20Vinnie Bacon 20 

How do you allow a community user to open up a file given the ContentDocumentId?

I have files linked to Contacts via another process. I can get the list of contentDocumentIds related to the Contact.

I have a Lightning component where the recordId is a Contact Id and I do a standard iteration on the ContentDocument records. I can display the file information and other details. But I can't for the life of me figure out how to generate a link to the file from the component.

Any help would be appreciated.
ShivankurShivankur (Salesforce Developers) 
Hi Vinnie,

Please check out below link to understand, how you can achieve this requirement:
https://help.salesforce.com/articleView?id=sf.custom_links_example_linking_to_documents.htm&type=5

Hope above information helps. Please mark as Best Answer so that it can help others in future.

Thanks.