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
keady@sfdckeady@sfdc 

How to get chatter file link?

Hi All,

 

I have a requirement where i need to get the link of the file shared/attached in chatter feed.

FeedItem does not have information related to this. FeedItem has RelatedRecordId which is a ID of a ContentVersion. But i could not able to get the link for that file. can someone please guide me or share the code how to get the link to that file. since i need to use that link in some custom object where the user should be able to go to that file on click on the link.

 

Thanks in advance 

Best Answer chosen by Admin (Salesforce Developers) 
Jia HuJia Hu

'ContentDocumentId' in the ContentVersion Object is the Id of the file.
If you want to share some files, the Id of ContentVersion is enough. Since the Content of Files is saved in the ContentVersion.

doc:

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

 

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

All Answers

Jia HuJia Hu

'ContentDocumentId' in the ContentVersion Object is the Id of the file.
If you want to share some files, the Id of ContentVersion is enough. Since the Content of Files is saved in the ContentVersion.

doc:

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

 

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

This was selected as the best answer
keady@sfdckeady@sfdc

Thank you very much! it worked.

Geetha ReddyGeetha Reddy

Hi ,

Are you working on Salesforce chatter integration with twiiter?

 

Jason T.ax1531Jason T.ax1531

do you select contentUrl from contentVersion for the chatter file  'share via link'? I'm trying to get the URL for 'share via link'.

 

thanks.