4

I have a Likes count column in a custom list .

I am trying to update the likecount from client side using REST API.

If a user has clicked on Like once, then it should disable the like button for that user.

It should only allow user to do that once. Any ideas out there?

  • Hey, see here for my blog post about that: afrait.com/blog/like-list-items-facebook-like-en and here: sharepoint.stackexchange.com/questions/163301/…. Maybe this helps – Patrick Feb 1 '16 at 17:32
  • thank u but its not soo relevant – meer Feb 1 '16 at 19:25
  • i want to do with REST API – meer Feb 2 '16 at 12:12
  • For me it looks pretty like REST in my blog, but maybe I am wrong?! – Patrick Feb 2 '16 at 12:14
  • not its not soo different but you are doing alot ,in my case i have just one title columns which need to be liked soo code should be very simple than yours. just GetCount for selected item and if user clicked before then disable. – meer Feb 2 '16 at 12:27
2

Instead of a count column you could have multi-value user column. The count of likes is the number of values in that column. So if the users ID is in the field, he will not be allowed to press like again.

Example:

 $.ajax({
    url: URL + "/_api/web/lists/getbytitle('FeedLikes')/items?
                       $select=Title,Users/ID&$expand=Users/ID"

Returned object:

 {"Users":[{"ID":30},{"ID":21}]}

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.