1

enter image description here

When users hover over the like column, they can see all the likers (users who liked the item.)

I wonder where does SharePoint store those information "likedby", and how can I retrieve it? For example, if I added the like column to a document library, how can I see a list of all the documents I have liked ?

2 Answers 2

1

1) Enable ratings in your document library. ( List/Library Settings > Rating Settings)

enter image description here

2) LikedBy is the column which stores the users who have liked list items.

After that you can use the below REST api to get all like by users:

https://sitecollectionurl/_api/web/Lists/GetByTitle('CustomDocLib')/items?$select=Title,LikedBy/Title,LikedBy/ID&$expand=LikedBy

Here LikedBy is OOTB column which is enabled after ratings is activated in the library.

7
  • What is "$expand=LikedBy" means? If we can retrieve via REST, does it mean I can get the data from Search? Because I can't find any managed property, can't get "LikedBy" from search tool either
    – YogaPanda
    Commented Jan 27, 2017 at 14:07
  • It just says The field or property 'LikedBy' does not exist
    – YogaPanda
    Commented Jan 27, 2017 at 14:12
  • LikedBy is a multi valued lookup column. So u need to use $expand it in the query. The error looks strange. Did you enable the ratings as i have in the screenshot ? Commented Jan 27, 2017 at 15:14
  • I enable the rating in the very first step, that's how I get the screenshot. I found another REST api actually works. Just slightly different from this answer
    – YogaPanda
    Commented Jan 27, 2017 at 15:19
  • It's the same endpoint. This answer is "$select=Title,LikedBy" but my site couldn't find LikedBy at that time. Another answer is "$select=LikesCount,LikedBy/Title&$expand=LikedBy" which enable me to get what I want
    – YogaPanda
    Commented Jan 27, 2017 at 15:28
1

This actually works for me after researching a while:

/_api/web/lists/GetByTitle('List Name')/Items?$select=LikesCount,LikedBy/Title&$expand=LikedBy

This SP CRUD Operation tutorial helps a lot.

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.