Where is the Web Control for the “Like” Rating?
-
13-01-2021 - |
Question
I am using the following code to display the rating on a publishing page in SharePoint 2016 On-Prem. However, the user would like to use the 'Like' instead of the 'Stars'. Changing the rating setting to 'Likes" didn't help, the page still shows star rating.
<div class="article-RatingContent">
Rate this Article<SharePointPortalControls:AverageRatingFieldControl ID="AverageRatingFieldControl" FieldName="AverageRating" runat="server"/>
Is there a different Web control Name for Likes"
Solution
yes, there is a different field , instead of avaragerating you want to use the LikesCount field , yet i think there's no web there's no web control,
I think the control behaves like a multi-user field. so you could try that and build your own custom field.
if current user is not in the likesCount : display "like"
if the current users i in the LikesCount : display "unlike"
on like: add user to the likescount
on unlike: remove user from the likescount
i have only seen CSOM to update the field, but not SSOM
list settings > Rating settings > likes