Enable rating in SharePoint 2010 custom content types

26. February 2011 18:15 by Rashid Aziz in Sharepoint blogs  //  Tags: ,   //   Comments
The rating allows users to rate items in lists and libraries in SharePoint. This is another highly usable and awesome feature tied to the Managed Metadata Service Application (MMS). To turn on ratings on a list you normally go to Library/List Settings > Rating Settings.     When you enable this on a list or a library SharePoint adds two columns to your list called: Rating (0-5) Number of Ratings But if you want to provision the rating with your Content Types and solution packages - you have to add the two rating columns to your content type.  Solution is here Create an empty SharePoint project in Visual Studio 2010 and add a new Content Type project item. Select a content type to derive your new content type from. Once the item is added then you will see the content type XML manifest. Add the following rating site columns as a FeildRef. <FieldRefs>   <FieldRef ID="{5a14d1ab-1513-48c7-97b3-657a5ba6c742}" Name="AverageRating" />   <FieldRef ID="{b1996002-9167-45e5-a4df-b2c41c6723c7}" Name="RatingCount" /> </FieldRefs> Add a new item to the project of the type “List Definition from Content Type” and use your newly created content type. Also check the checkbox to create a list instance. Then deploy your solution to SharePoint and navigate to the new list that should have been created. If you create a new list item or upload a document you will see that the Rating has been enabled. You can also check the Rating Settings for the list or the library and verify that Ratings has been enabled.

Sharepoint 2010 rating feature

16. February 2011 08:06 by Rashid Aziz in Sharepoint blogs  //  Tags: ,   //   Comments
Rating: In SharePoint 2010 there is a new feature called Ratings. Ratings are very generic things that have a lot of flexibility they allow: 1).Users to rate content (of any type, Lists, Documents, Pages on a site, and even Content Types). 2).Store that ratings data in the database just like the new social tags that are part of 2010. 3).A rating represents the average score from all users submitting a rating for that item. 4).SharePoint Server provides the rating store, a control to rate items, and a web service to collect and consume the ratings. This service can be used from anywhere inside or outside of the system, including Office 2010 clients. 5).Ratings feature activated, you can enable support for it in individual document libraries.  When it’s turned on, users will see an interface like this: Getting Started: To start with ratings, we take a simple list with some movie titles in it that we’ll enable ratings on. To enable ratings, we go into the settings for this list. Under General Settings for the list you’ll see a new option called Ratings settings. Select this and you’ll see the option to turn ratings on or off for this list. It works the same for a Document Library. Now two new columns have been added (from the site columns the service created above). A Rating column (this is a new Content Type) and a Number column to hold the number or ratings. Each time a user clicks on a rating for each item, the number goes up. This is used to average out the rating score to produce the overall rating value for the item. Now when we look at our list we see the new Rating and Counter columns added (they’re added by default to your list but you can change this in the view just like any other column). As you hover your mouse over the stars the color changes to yellow to reflect the rating you’re about to assign via a mouse click.   Once you click on a rating a confirmation tooltip is shown. This is the second star in the ratings control and displays the current user’s personalized rating. This is all done asynchronously so there are no icky postbacks. Purpose to build it: SharePoint 2007 doesn’t provide any rating capabilities. As for SharePoint 2010 – it does provide new rating capabilities, but still has some limitations such as: No support for voting (thumb-up/thumb-down) and “Kicking” rating methods No support for adding comments to ratings No support for locking an item from being rated after a defined date How to add rating to SharePoint 2010? Created a custom content type and page layout inherited from the OOTB article page layout.  Within this page layout, users are able to rate the content on the page from a scale of 1 to 5.Enable ratings within my list settings by going to the /Pages/Forms/AllItems.aspx view and clicking on the Library Settings link on the Library tab of the ribbon: Enable rating functionality on the list by going Rating Settings and checking the “Allow items in this list to be rated?” –> yes radio button:  Two new site columns/meta-data columns to my list called Number of Ratings and Rating (0-5):   Now, on my pages list, on the allitems.aspx view, it added a new rating field type web control associated with those columns: Now Ajax functionality allows you to rate the item without checking out the list item. Now from the timer job called “User Profile Service Application – Social Rating Synchronization Job” (Central Admin –> Monitoring –> Review Job Definitions) and pressed the Run Now button.  After a minute or so, the average rating showed up. Now a rating control on content page layout which users can now use to rate:   

Stay connected

SharePoint Links

Month List