2

We are unable to create a SharePoint list with rating enabled on it.
Can someone help us in creating XML schema for the above requirement.
Thanks in advance.

2 Answers 2

0

If you create a test list and enable ratings. Extract a template containing the list and you will see relevant artifacts. You will need to sure the underlying columns such as ratedby under the site fields element

0

For rating enabled list, we need to add 6 column below, 4 for rating and 2 for likes:

Guid RatingsFieldGuid_AverageRating = new Guid("5a14d1ab-1513-48c7-97b3-657a5ba6c742");
             Guid RatingsFieldGuid_RatingCount = new Guid("b1996002-9167-45e5-a4df-b2c41c6723c7");
             Guid RatingsFieldGuid_RatedBy = new Guid("4D64B067-08C3-43DC-A87B-8B8E01673313");
             Guid RatingsFieldGuid_Ratings = new Guid("434F51FB-FFD2-4A0E-A03B-CA3131AC67BA");
             Guid LikeFieldGuid_LikedBy = new Guid("2cdcd5eb-846d-4f4d-9aaf-73e8e73c7312");
             Guid LikeFieldGuid_LikeCount = new Guid("6e4d832b-f610-41a8-b3e0-239608efda41");

Then you could enable the rating settings using PnP C# code like below:

How To Enable Ratings/Likes For A List In SharePoint Office 365 Programmatically Using PNP C#

For list schema definition, you could simply create a list with rating enabled and then get the list schema using PnP PowerShell:

Connect-PnPOnline –Url https://tenant.sharepoint.com/sites/jerrydev/ –Credentials (Get-Credential)
$list = Get-PnPList -Identity "ratinglist" -Includes SchemaXml
$list.SchemaXml

It will return the whole schema definition then you could use to provision.

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.