0

在我发布这个问题之前,我已经做了一些研究以找到解决方案......没有运气

这是我找到的一些项目的链接

SharePoint 2013 托管应用程序中的文档评级

http://www.wictorwilen.se/Post/How-to-provision-SharePoint-2010-Rating-columns-in-Content-Types.aspx

我在这里遇到的问题是我有一个自定义列表,它是 sharepoint 应用程序的一部分,需要添加 sharepoint 评级系统

当我将 wictorwilen 中建议的列添加到列表 schema.xml 中时,我得到的只是列表中的几个数字字段。

如何在应用网站集和/或列表实例中启用“评分”功能?

这是 listInstance 架构 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>
4

1 回答 1

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.
于 2015-12-22T09:09:35.847 回答