I have SharePoint Online environment, I use custom page layout for a specific publishing SP site.

When i go to "Rating settings" for the default page library with in the site and i activate "Allow items in this list to be rated?" and select "Likes" in the field. I get the Like/Unlike just for Allitems.aspx page.

I want to embed the same functionality on every page that uses my custom page layout.

I found the web controls that does the Rating functionality,

<SharePointPortalControls:AverageRatingFieldControl FieldName="5a14d1ab-1513-48c7-97b3-657a5ba6c742" runat="server"/>

This code adds Page Ratings on all pages that uses the custom page layout.

Page with Rating.

I want to add something similar to get "Like feature" instead of Page Rating.

Are there any web controls or custom code options available for SharePoint Online?

I tried this, http://npatro.com/using-like-and-rating-functionality-in-sharepoint-2013-pages/, but that din help.

Please suggest.


  • Do you mean like Facebook likes ?
    – Sukumar MS
    Apr 9 '19 at 13:29
  • wp.sjkp.dk/… see this blog post, it will help.
    – 111
    Apr 11 '19 at 7:43

You can use the below rest api to get the likes count as well as who all are liked your page.

/_api/web/lists("Pages library GUID")/items("itemID")/likedByInformation?$expand=likedby

For this api you have to pass Pages library GUID and item ID. It is a get request.


I have used Waldek Mastykarz feature to do this. It works for SharePoint 2016 as well.



  • The Blog says, its a WSP solution. It will not work on SharePoint Online
    – Asad Refai
    Apr 11 '19 at 12:43
  • This din't work on SharePoint Online.
    – AXA240778
    Apr 23 '19 at 17:31

Following this article, https://gist.github.com/sjkp/5563092 and writing some validations, I was able to achieve what i was looking for.

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.