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

Different types of Chatter files (uploads)?

Hi all,


there seem to be two different ways of adding files to chatter. For example, if you click on the "attach a file" button, it will give you two alternatives:


a) Select a file from Salesforce

b) Upload a file from your computer


On a) you would have to add a file to your Content (in Workspaces) first


Now, as far as I assumed before, both should lead to the same entries in the chatter feed. However, there is one detail, that differs:


All my entries created with method a) will have an additial link "Go to Content Detail Page".


Now my core problem is that I need to find a way to create chatter file posts of type a) using the API, so far all my tries ended up as type b), so missing "Go to Content Detail Page" link.


What I'm doing so far:

- Adding a "ContentVersion" record (=doing a file upload)

- Using the Id of the created ContentVersion to add a "FeedPost" record and pointing its "ParentId" to the object that should list the new Chatter post


So, what am I missing here?





You might want to check out the updates in Spring 11 when dealing with Content and Chatter Files. Check out the release notes for more information:



I have just begun looking into the release notes, however, What we are trying to do is relatively simple and should be a few lines of code.


1) we have attachments which have parent Ids of custom objects. 

2) we want to have these attachments posted in chatter (The parent objects feed) via Apex code


I see there are ways to specific a path to a file but that doesn't make much sense.


Should be able to specific an Attachment Object ID in the chatter post and it will be posted in the parent of that attachment.