0

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>
Community
  • 1
  • 1
Noah Wallace
  • 118
  • 7

1 Answers1

0

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:

  1. Add the Rating fields
  2. Set the property on the root folder (Ratings/Likes)
  3. Add the View fields for Ratings or Likes.
  • Im going to take a look into this. i will need to make the change to the library when the app is installed...a little tricky when trying to implement in javascript – Noah Wallace Dec 22 '15 at 19:19
  • I recommend the following approach. Add the functionality in the start page of your app. After the library is configured, add a custom value to the web property's bag. Each time when the start page is accessed, just check the property bag. Depending on how your app is set up there could be better ways, but this would always work. – florinszilagyi Dec 23 '15 at 07:05