Question

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.

Thanks

Était-ce utile?

La solution 3

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

Autres conseils

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.

https://blog.mastykarz.nl/like-publishing-pages-sharepoint-2013/

Bismarck

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top