Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How can you retrieve a list items "Likes" using the JSOM or REST API's? I know there is the following method: SP.Social.SocialFeedManager.getAllLikers(postId), but in testing I was not successful using the "posts" item id as the methods postId.

Any help or direction as to how this is done would be greatly appreciated.

share|improve this question
    
Where you using the posts ID (around two or three digits long) or its GUID? –  Robert Lindgren May 7 '13 at 5:49
    
Hi Robert, I did try both methods, passing in the int ID as well as the item GUID. Maybe I am not loading my client context correctly? If you could provide an example, I'd greatly appreciate it. Thanks! –  MarcusTheShogun May 7 '13 at 12:02
4  
Better you copy paste in your code here so everyone can see it, and maybee spot some errors :) –  Robert Lindgren May 7 '13 at 12:06
add comment

2 Answers

I found an article (link below) that had a code snippet to get all likers (Graphic). Sounded like it might be useful for your problem.

http://www.techbubbles.com/sharepoint/social-features-in-sharepoint-2013-part2/

enter image description here

share|improve this answer
add comment

I found a CSOM example here that's simply pinging a list item's "AverageRating", "RatingCount", and "Ratings" props to give you the item's rating info. The challenge though is in converting this to JSOM...

using (ClientContext ctx = new ClientContext("https://yourSiteUrl")){
    Web w = ctx.Web;
    List l = w.Lists.GetByTitle("yourListName");

    CamlQuery cq = CamlQuery.CreateAllItemsQuery();
    ListItemCollection lic = l.GetItems(cq);

    ctx.Load(lic, items => 
        items.IncludeWithDefaultProperties(
        item => item.Id,
        item => item["AverageRating"],
        item => item["RatingCount"],
        item => item["Ratings"]));

     ctx.ExecuteQuery();
     foreach (ListItem li in lic){
          Debug.WriteLine(li["AverageRating"]);
          Debug.WriteLine(li["RatingCount"]);
          Debug.WriteLine(li["Ratings"]);
      }
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.