How to enable rating/like settings while creating custom list declaratively in SharePoint 2013

797 Views Asked by At

I am creating Custom List Definition and List Instances for SharePoint 2013 declaratively using CAML. How can I enable the Like/Ratings settings activated by default for all my List Instances.

Ofcourse, one way is to activate from "Rating Settings" from List Settings page of the list, this is not what needed. Thanks

1

There are 1 best solutions below

0
On

In order for SharePoint to make rating available for your content you need to add rating fields to your list definition.

<FieldRef ID="{5a14d1ab-1513-48c7-97b3-657a5ba6c742}" Name="AverageRating" />
<FieldRef ID="{b1996002-9167-45e5-a4df-b2c41c6723c7}" Name="RatingCount" />

Information is taken from this blog post by Wictor Wilen. It is for SharePoint 2010 but the mechanics are the same. Adding the fields that are required by functionality should be enough to enable the functionality for the list