I have a Lightning Web Component, its job is to return all the documents related to a record. I have tested the web component by running it internally and it looks like it is performing as expected. As soon as I take the same web component and place it on a community portal page the LWC does not run leading me to believe that the Profile which the community user is running does not have access to the 2 default object: ContentDocumentLink and ContentDocument.

I have made sure that the community user profile has all the access levels to access this record to which these files are related.

Is there a way to give community portal user profile access to these 2 objects? I do not want to set the visibility of each file to everyone as this post suggests.

1 Answer 1


You have no choice but to set Visibility = AllUsers in the ContentDocumentLink record. The documentation is poorly worded:

AllUsers—The file is available to all users who have permission to see the file. InternalUsers—The file is available only to internal users who have permission to see the file.

But the implication is that even if Partner users have permissions to the parent record, they don't have permissions to the file unless you set AllUsers.

  • Hi @David Cheng, so if I set the ContentDocumentLink to all users, do I have to do the same for ContentDocument? furthermore, does this mean potentially 2 different users can see each other's files? that's a huge privacy breach. Also what about the sharing is there a way to share the files as they upload to a specific user? would that work? Sep 6, 2022 at 18:56
  • 1
    Visibility is controlled in the ContentDocumentLink, not in ContentDocument. Again, the documentation implies that if the partner user A has sharing permissions on a parent record but user B does not have permissions, then AllUsers allows user A to see the file but user B will not. I think if a ContentDocument has multiple contentdocumentlinks to different objects with different sharing, then the file could be visible or not depending on which object is being viewed. You'll have to try it in a sandbox. Sep 6, 2022 at 19:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .