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
mnickelsmnickels 

Need code to get link to chatter document

Hello,

 

When a user uploads a document to chatter and selects the "everyone with a link permission" salesforce.com generates a link.

 

How can I get that link through Apex code?

 

Currently I'm using the following, but nothing relates the the link that salesforce.com gives me.

 

SELECT ID, ContentDocument.LatestPublishedVersion.Title, ContentDocument.LatestPublishedVersion.Description, ContentDocument.LatestPublishedVersion.PathOnClient FROM ContentDocumentLink WHERE LinkedEntityId=:c.Id

 

As a secondary step, is it possible to automatically set view permissions on an uploaded document to everyone through apex?

 

Thanks,

 

- Mike