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
Sure@DreamSure@Dream 

id of the user who posted the feeditem/ comment

Hi All,

How to get the id of the user who posted the feeditem/ comment using  Chatter In Apex/Connect API

Thanks in advance :)
Ashish_SFDCAshish_SFDC
Hi , 


To Feed  /chatter/feeds/to/userId  Return a list of entities where a user has been @mentioned
User-Profile Feed  /chatter/feeds/user-profile/userId  News Feed resource by including posts, status, group and record updates.
Users  /chatter/users/userId  Returns a user's Chatter profile details, such as email, phone number, status, profile image, and "About Me"

https://wiki.developerforce.com/page/Getting_Started_with_the_Chatter_REST_API

http://www.salesforce.com/us/developer/docs/chatterapi/Content/connect_resources_how_to.htm


Regards,
Ashish
Sure@DreamSure@Dream
Hi Ashish,


Thanks for your reply.

I am using Connect API method ConnectAPI.ChatterFeeds.getFeedItemsFromFeed() to get the feeditems from a particular group.
I want to know the Id of the user who posted it or commented on a post, using feeditem class in the Chatter API

Sure@DreamSure@Dream
I am able to find out the id of the user who commented.
There is a field User in the Comment, User.id will give me the id of the user who commented on the post.


But couldnt find out how to get the id of the user who created the feeditem.
Ashish_SFDCAshish_SFDC
Hi , 


See the below Article should help, 

Preamble (ConnectApi.FeedItem.preamble)—Provides context. The same feed item can have a different preamble depending on who posted it and where. For example, Gordon posted this feed item to his profile. If he then shared it to a group, the preamble of the feed item in the group feed would be “Gordon Johnson (originally posted by Gordon Johnson)” and the “originally posted” text would link to the feed item on Gordon’s profile.

http://www.salesforce.com/us/developer/docs/chatterapi/Content/intro_feeds_feed_items.htm


Regards,
Ashish
Sure@DreamSure@Dream
Hi Ashish,


Thank you. I have seen this link before, but I am not sure how to proceed with this.

I feel Actor should be the one that needs to be used. There is a sub class ActorWithId for Actor class. In that class Id field is there.

But I dont know how to get that.


Thanks.
Ashish_SFDCAshish_SFDC
Hi , 


Did you try this method for get actor id? In the same link. 

User Profile Feed POST /chatter/feeds/user-profile​/userId/feed-items ConnectApi.ChatterFeeds​.postFeedItem​(communityIdOrNull, ConnectApi.FeedType.UserProfile, userId)


Regards,
Ashish