4

Is there any way that I can see who liked a sharepoint item outside of the "hover the smiley face" and a popup shows the users who liked it?

Ideally, I would like to export every single user who has liked an item within the entire list to something like excel, where I can analyze it.

1

I know its too late but it might help others:

<script>
    $(document).ready(function() {
      $(".ms-comm-likesMetadata").mouseover(function() {
        var endpoint = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('List name')/Items("+ parseInt(this.nextElementSibling.id.split('-')[1])+")?$select=LikedBy/Title&$expand=LikedBy"
        $.when($.ajax({
           url: endpoint,
           async:false,
           method: "GET",  
           headers: { "Accept": "application/json; odata=verbose" },
           success: function (data) {           
           if(data.d.LikedBy.results.length > 0)
           {
              for(var pp=0;pp<data.d.LikedBy.results.length;pp++)
              {              
               alert(data.d.LikedBy.results[pp].Title);
              }
           }
           }, error: function (err)  {

           }
      })).done(function(data) {              
      });   
   });
});
</script>
| improve this answer | |
0

You can create a SP Designer workflow to do this. Research some examples of using the Call HTTP web service action in SP Designer for more specifics, but here is a summary:

Call HTTP Web Service (HTTP Get) to your list, example HTTP web service URL: yoursite/_api/web/lists/GetByTitle('Posts')/Items?$select=LikesCount,LikedBy/Title&$expand=LikedBy&$filter=Title eq ('Title*')

Title*= set equal to current item title

Then Get Item from Dictionary: Get (0)/LikedBy/results output to another dictionary variable (LikedByDic).

Count items in above step and then create Loop to run through the second dictionary.

Within the Loop, Get (CountVariableUsedInLoop)/Title from the second dictionary (LikedByDic) output to string variable(UserLikedBy)(this will be the user who liked the post).

I created another string variable (AllUsers) within the loop to add each user: Set Variable: AllUsers to [%Variable:UserLikedBy%];[%Variable:AllUsers%]

Then a final step after the loop stage to email me the value of this string variable (AllUsers).

| improve this answer | |
0

Srujans answer worked like a charm. I made a minor modification to be able to show the response side by side with the list. Place the follwoing next to you list in a script editor.

<script>
$(document).ready(function () {
    $(".ms-comm-likesMetadata").mouseover(function () {
        var endpoint = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('YOUR LIST NAME')/Items(" + parseInt(this.nextElementSibling.id.split('-')[1]) + ")?$select=LikedBy/Title&$expand=LikedBy"
        $.when($.ajax({
            url: endpoint,
            async: false,
            method: "GET",
            headers: { "Accept": "application/json; odata=verbose" },
            success: function (data) {
                // console.log(data.d.LikedBy.results.length);
                if (data.d.LikedBy.results.length > 0) {
                    $("#user").empty();
                    var users = [];
                    for (var pp = 0; pp < data.d.LikedBy.results.length; pp++) {
                        var user = data.d.LikedBy.results[pp].Title;
                        users.push(user);
                        // console.log(users);
                    }
                    users.sort();
                    for (var i = 0; i < users.length; i++) {
                        nameList = "<li>" + users[i] + "</li>";
                        document.getElementById("user").innerHTML += nameList;
                    }
                }
            }, error: function (err) { }
        })).done(function (data) { });
    });
});

</script>

<ul id="user" style="list-style-type:none;"></ul>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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