You need to sign in to do that
Don't have an account?
Motoki
How to following a Chatter file in Apex
Hi guys,
I was wondering how do you following a Chatter uploaded file in apex code please? i know how to following a record or a user or how to copy a record FeedItem into another record but i'm not so sure how different it is to follow a file so the user who is already following that record gets the updates for the file as well...
Any information would be great help.
Thank you very much for your help in advance.
Best Regards,
Motoki
Hello, not even one person knows if it is possible to follow a file via Apex code?
Following a file is the same as following anything else - create a new record in EntitySubscription:
http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_objects_entitysubscription.htm#kanchor278
Grab the file id from this object:
http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_objects_contentversion.htm#kanchor204
Thanks for your reply. I just did a query on the ContentVersion and ContentDocument objects in my schema browser and i can't find any reference to my chatter file at all... However, i did found the file in the FeedPost object that belongs to my custom object feed. Apex doesn't let me put a FeedPostId in EntitySubscription's parentId field...
Is there any chance it is stored in another object?
Best Regards,
Motoki
I'm not sure why the file didn't appear in the query for ContentVersionId nor ContentDocument as it should be in both of them.
The first 3 characters of ContentDocumentId should be "069" as all files start with that index - that might help you make sure you hvae the correct Id.
The FeedPostId won't work as that's no thte Id of the file, but rather that of the post itself.
Note in 2 weeks (mid June, 2011), the files team is exposing ContentDocumentId on FeedPost so you can Insert new FeedPosts referencing existing files. Today, that is not possible.