Reputation: 118
Before i posted this question i have done some research to find the solution...with no luck
Here are some links to items i found
document rating in SharePoint 2013 hosted app
http://www.wictorwilen.se/Post/How-to-provision-SharePoint-2010-Rating-columns-in-Content-Types.aspx
The issue i have here is that i have a custom list that is part of the sharepoint app and need to add the sharepoint ratings system
When i add the columns as suggested in wictorwilen's to the list schema.xml, I get nothing more than a couple of number fields in the list.
How do i enable the "Ratings" feature in the app site collection and/or on the list instance?
this is the listInstance schema xml
<ContentTypes>
<ContentType ID="0x0100BE18ADD378B44660BBA9D7BDA8D445DC" Name="StoryBoard" Group="Custom Content Types" Description="StoryBoard Content Type" Inherits="False" Version="0">
<FieldRefs>
<FieldRef ID="{10aee775-aefb-4cf6-9bbc-5012504b929e}" DisplayName="Story Title" Required="TRUE" Name="StoryTitle" />
<FieldRef ID="{7DF0EBE6-D778-42C1-9687-C5058E5F09AA}" DisplayName="Story Image" Required="FALSE" Name="StoryImage" />
<FieldRef ID="{FCA44B87-91A7-4B19-B920-A28B2190DCDA}" DisplayName="Publish Date" Required="TRUE" Name="PublishDate" />
<FieldRef ID="{D36C06FE-0242-48EC-AE60-0910D759EAA0}" DisplayName="On Behalf Of" Required="TRUE" Name="OnBehalfOf" />
<FieldRef ID="{C56AABCD-03A9-4572-A716-125414AEEB6D}" DisplayName="Story" Required="TRUE" Name="Story" />
<FieldRef ID="{5a14d1ab-1513-48c7-97b3-657a5ba6c742}" Name="AverageRating" />
<FieldRef ID="{b1996002-9167-45e5-a4df-b2c41c6723c7}" Name="RatingCount" />
</FieldRefs>
</ContentType>
</ContentTypes>
<Fields>
<Field ID="{10aee775-aefb-4cf6-9bbc-5012504b929e}" Name="StoryTitle" DisplayName="Story Title" Type="Text" Required="TRUE" Group="Custom Site Columns"></Field>
<Field ID="{7DF0EBE6-D778-42C1-9687-C5058E5F09AA}" Name="StoryImage" DisplayName="Story Image" Type="URL" Required="FALSE" Group="Custom Site Columns"></Field>
<Field ID="{FCA44B87-91A7-4B19-B920-A28B2190DCDA}" Name="PublishDate" DisplayName="Publish Date" Type="DateTime" Required="TRUE" Group="Custom Site Columns"></Field>
<Field ID="{D36C06FE-0242-48EC-AE60-0910D759EAA0}" Name="OnBehalfOf" DisplayName="On Behalf Of" Type="User" Required="FALSE" Group="Custom Site Columns"></Field>
<Field ID="{C56AABCD-03A9-4572-A716-125414AEEB6D}" Name="Story" DisplayName="Story" Type="Note" Required="FALSE" RichText="TRUE" RichTextMode="FullHtml" Group="Custom Site Columns"></Field>
<Field ID="{5a14d1ab-1513-48c7-97b3-657a5ba6c742}" Name="AverageRating" Type="Number"></Field>
<Field ID="{b1996002-9167-45e5-a4df-b2c41c6723c7}" Name="RatingCount" Type="Number"></Field>
</Fields>
Upvotes: 0
Views: 543
Reputation: 101
Along the fields, the list root folder needs to have a property, "Ratings_VotingExperience" set to "Ratings" or "Likes". Here is the code using C# CSOM.
list.RootFolder.Properties["Ratings_VotingExperience"] = "Ratings";
Another option, would be to use CSOM entirely, without a custom Schema.xml. Here is a tested approach on enabling ratings on a list. You would have to convert the code from C# to Javascript, but this is trivial.
The basic steps are:
Upvotes: 0