2

I have a site with a Visualforce page that requires access to ContentDocuments linked to an Opportunity. My problem is that i can only see, as a public guest user, content documents that are uploaded via APEX, but not via the standard button. Both records have the same permissions, and ContentDocumentLinks, but i can only access the one that was uploaded via apex. Is there any object that its created that gives this permission to the public guest user?

1
  • I know this is really old, but we are running into the same issue where if we upload a file through Apex, the file will be visible to a public guest user, but if the file is uploaded by a standard type user, the file is not accessible. Have you had any progress with finding a solution?
    – joe.stolz
    Commented Aug 10, 2018 at 14:58

1 Answer 1

1

I had a similar problem and believe I found a workaround. Creating a before insert trigger on ContentVersion that sets the Origin field to C, along with a before insert trigger on ContentDocumentLink that sets Visibility to AllUsers, allowed the public force.com site guest user to access the Salesforce File which was uploaded by the out of the box UI. So records started being returned when querying ContentDocumentLink and ContentVersion as the site user after uploading with those trigger changes in place. 

You must log in to answer this question.

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