תשובה How do I display SharePoint ratings (Rating 0-5) on a page?

  • Friday, September 17, 2010 5:27 AM
     
     

    Hi,

    I want to display SharePoint ratings on a page, like in this example

    https://sharepoint.microsoft.com/en-us/Pages/Videos.aspx  

    I've enabled ratings in a SharePoint List (for my videos) and I just want to use those ratings ( Rating (0-5) ) on a page, exactly as used in the given exmaple.

    Regards

All Replies

  • Saturday, September 18, 2010 10:50 PM
     
     Answered Has Code
    How-To: Lets begin with setting up Rating Control for a Custom List first.
    Step # 1 Enable / Start the 'User Profile Service' from the CA > System Settings > Servers > Manage services on server ( by default it is Started ).
    Step # 2 Under CA > Monitoring > Timer Jobs > Review Job Definitions > look for 'User Profile Service Application - Social Data Maintenance Job' and

    'User Profile Service Application - Social Rating Synchronization Job'.
    These jobs are scheduled by default to run every 1 hr. 


    Step # 3 For our convenience and testing, schedule both these jobs to run every 1 min as shown below.
    Also do the same for
    'User Profile Service Application - Social Rating Synchronization Job'


    Step # 4 Ok you are now all set. Go to the List level ( your desired List / Doc Lib ) and get to the List Settings
    Step # 5 Select the Rating Settings on the General Settings option and choose the option 'Yes' for 'Allow items in this list to be rated?'
    Step # 6 Once you choose this option, 2 new columns will be added to your list as shown below
    Rating (0-5) will give you the 5 star rating asynchronous control that you can rate any item for.
    Number of Ratings will display how many unique users rated the item.

    Remmember that if same user rates twice, it will override his / her previous rating
    ( and will not aggregate ).

    Rating control will average ratings of unique users rating on item basis.
    Step # 7 User ratings are collected asynchronously as shown below.
    Step # 8 Once you submit rating, you will be also shown the success message.
    Step # 9 Wait for a minute since the timer jobs is set to run for every 1 min as configured earlier. View the list webpart and notice that the ratings will be changed.
    Step # 10 Perfect! Lets now see how to use this Rating Control on a Page. First we need the Page level register tag.
    <%@ Register Tagprefix="SharePointPortalControls" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

    Step  # 11 Once you register the Control Tag, use the below control code and add it to the PlaceHolderMain section.
    Make sure that the FieldRef Name matches the column name. You are all set now.

    <SharePointPortalControls:AverageRatingFieldControl id="PageRatingControl" FieldName="Rating (0-5)" runat="server" />

     

    To use Rating Feature in search read this:

    http://blogs.technet.com/b/speschka/archive/2009/10/28/using-the-new-sharepoint-2010-ratings-feature-in-search.aspx


    Wali Systems Inc. (http://walisystems.com) Hire certified virtual SharePoint assistants/developers!
    • Marked As Answer by KeFang Chen Monday, September 20, 2010 9:39 AM
    •  
  • Sunday, September 19, 2010 2:54 PM
     
     Answered

    The above is for SharePoint 2010, assuming you posted this in the pre-SharePoint 2010 forums you want a solution for SharePoint 2007.  There's a codeplex project to achieve this functionality, please see http://spdocrating.codeplex.com/

    Hope this helps

    Dave


    My SharePoint Blog - http://www.davehunter.co.uk/blog
    • Marked As Answer by KeFang Chen Monday, September 20, 2010 9:39 AM
    •