Spice up your ECM with Ratings in SharePoint 2010!

Posted Monday, November 22, 2010 10:23 AM by CoreyRoth

At Tulsa TechFest, I gave a talk about the various new ECM features available out of the box in SharePoint 2010.  One feature of particular interest to the crowd was average ratings.  I had lots of questions on it so I thought it was worth a blog post.  Instead of describing it first, let’s start with a picture.

DocumentLibraryViewWithRatings

As you can see in the above picture, ratings are a new field available which gives users the ability to rate each document using stars just like they might do in iTunes or any other application.  Behind the scenes, it takes the ratings of each user and a timer job comes along periodically and calculates the average rating.  This allows users to quickly determine which documents are the most popular when viewing a document library.  You can also sort on this field as well.  It’s easy to add to both your document libraries and content types.

In reality, Ratings are nothing more than a site column, but SharePoint 2010 makes it really easy to add them to an existing document library.  Just click on Library Settings in the ribbon and then Ratings settings

DocumentLibraryEnableRatings

One you do that, two new site columns are added to your document library, Rating (0-5) and Number of Ratings.  The Rating (0-5) site column, named AverageRating internally, is the column users interact with.  Users can’t edit the Number of Ratings column, named RatingCount internally.  The timer job just uses it to help calculate the average.

DocumentLibraryRatingsSiteColumns

At this point, your users can start rating documents.  It’s that simple.   When you view the properties on a document, you will see the average rating and the number of ratings as well.

DocumentLibraryItemPropertiesWithRatings

In reality, you can actually just add the above two site columns to any list or content type and have ratings work.  I have actually started including these in my base content type on most ECM deployments.  This is a content type that I use in lieu of the Document content type which has additional site columns.  All other content types I create will inherit from this one.  It adds great functionality to every content type that inherits from it.  If some people don’t like the ratings on their documents, they can always just remove it from the view on his or her document library. 

To add the columns to a content type, just click the Add from existing site columns link on your content type page.  You will find the two columns listed in the Ratings Group.  You will want to add both of them to your content type.

ContentTypeRatingsColumns

When you add one of these columns, you will get a warning stating that some earlier versions of Office cannot use these fields.  If you are using Office 2007 or earlier, you may want to test this out some to see if it will be an issue in your organization.

ContentTypeRatingsWarning

Once you click OK, your content type is ready for use.  Now, I would be a bad blogger if I didn’t show you how to add these fields using CAML.  If you want to add these two fields to a content type, just add the following elements to the FieldRefs element.

<FieldRef ID="{5a14d1ab-1513-48c7-97b3-657a5ba6c742}" Name="AverageRating" />

<FieldRef ID="{b1996002-9167-45e5-a4df-b2c41c6723c7}" Name="RatingCount" />

Since these fields are included out-of-the-box, I believe those GUIDs should always be the same.  If I’m wrong, someone let me know.  You can also add these fields to document libraries as well.  Just add the following Field elements to the Fields element in your schema.xml.

<Field ID="{5a14d1ab-1513-48c7-97b3-657a5ba6c742}" Name="AverageRating" StaticName="AverageRating" DisplayName="Rating (0-5)" Description="Average value of all the ratings that have been submitted" Group="Ratings" Type="AverageRating" Decimals="2" Min="0" Max="5" ShowInEditForm="TRUE" ShowInDisplayForm="TRUE" ShowInNewForm="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" RowOrdinal="0" />

<Field ID="{b1996002-9167-45e5-a4df-b2c41c6723c7}" Name="RatingCount" StaticName="RatingCount" DisplayName="Number of Ratings" Description="Number of ratings submitted" Group="Ratings" Type="RatingCount" Min="0" Decimals="0" ShowInEditForm="FALSE" ShowInDisplayForm="TRUE" ShowInNewForm="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" RowOrdinal="0" />

Try out document ratings today.  They provide a lot of functionality and are quite easy to implement.

Comments

# Twitter Trackbacks for Spice up your ECM with Ratings in SharePoint 2010! - Corey Roth [dotnetmafia.com] on Topsy.com

Pingback from  Twitter Trackbacks for                 Spice up your ECM with Ratings in SharePoint 2010! - Corey Roth         [dotnetmafia.com]        on Topsy.com

# Is SharePoint good for ECM?

Thursday, November 25, 2010 9:55 AM by Is SharePoint good for ECM?

Pingback from  Is SharePoint good for ECM?

# Is SharePoint good for ECM? | EndUserSharePoint.com

Friday, December 3, 2010 9:31 AM by Is SharePoint good for ECM? | EndUserSharePoint.com

Pingback from  Is SharePoint good for ECM? | EndUserSharePoint.com

# re: Spice up your ECM with Ratings in SharePoint 2010!

Friday, January 28, 2011 5:16 PM by Lee Ann

I'm looking for a way to reset the ratings on a document when a new major version is published.  Is there any way to do this with the current rating system?

# re: Spice up your ECM with Ratings in SharePoint 2010!

Monday, June 3, 2013 9:32 AM by Mel

Thank you, helped a lot!

# Is SharePoint good for ECM? | NothingButSharePoint.com

Saturday, December 6, 2014 7:41 AM by Is SharePoint good for ECM? | NothingButSharePoint.com

Pingback from  Is SharePoint good for ECM? | NothingButSharePoint.com

Leave a Comment

(required)
(required)
(optional)
(required)