5

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?

5
  • 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
    Commented Feb 1, 2016 at 17:32
  • thank u but its not soo relevant
    – meer
    Commented Feb 1, 2016 at 19:25
  • i want to do with REST API
    – meer
    Commented Feb 2, 2016 at 12:12
  • For me it looks pretty like REST in my blog, but maybe I am wrong?!
    – Patrick
    Commented Feb 2, 2016 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
    Commented Feb 2, 2016 at 12:27

1 Answer 1

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 and acknowledge you have read our privacy policy.

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