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
atulajawaleatulajawale 

How to share a chatter post file programmatically to user

Hello All,

 

We can share a file posted on the chatter using GUI to a user , I am trying to achive the same in apex but not getting which object stores that information . ContentVersion is the object stores file but where how the sharing is stored ?

 

Regards,

Atul

Jia HuJia Hu

The sharing information of Chatter files is stored in the ContentDocumentLink, see the document:

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_contentdocumentlink.htm

 

but this object is read only.

 

You can query the current sharing info. but cannot insert new sharing.

 

Chandra SfdChandra Sfd
Hi Atul, were you able to programatically share a chatter image posted on a record to other users? 

I see that a new record is getting inserted into ContentDocument when I upload an image to chatter feed from the record detail page. I am able to query it but the images uploaded by other users are not part of the query. It looks like when we upload an image, it is privately shared. How to automatically make the chatter images visible to all the users? Thank you!