Blog » SharePoint

800.705.0401 | 858.458.4222

LinkedInFacebookTwitterHershey Technologies RSS Feed

Contact Us | Careers 


 

The right way and wrong way to use the “Rating (0-5)” field in a SharePoint list or library

Posted in [SharePoint 2010] By Tom Castiglia

The scenario

If you wish to utilize Ratings on a SharePoint list or library, you might think that you can do so by simply adding the “Rating (0-5)” site column to your existing list, library or content type.  In fact, SharePoint will allow you to do that, however doing so may or may not provide the intended results.

 

As you may already know, the proper way to enable ratings, is from the list’s settings page.  Click on the “Ratings settings” link and simply select the the “Yes” option for: “Allow items in this list to be rated?", as shown below:

image

image

 

When you enable Ratings this way, you’ll find that your list automatically gets the “Rating (0-5)” and “Number of Ratings” column and that the “Rating (0-5)” column is automatically added to the default view as well.  But this is not what I did!

 

In the course adding some other site columns to a document library I recently created, I noticed the existing site columns for "Rating (0-5)” and the “Number of Ratings”.  So I decided to simply add those columns to my library (without specifically enabling the Ratings as described above).  Note that this was the first list or library in my new relatively SharePoint 2010 farm that was using Ratings.

 

After adding these site columns to the library, we attempted to create some ratings by the hovering the mouse of the Ratings (0-5) column.  Normally, hovering the mouse over the stars in the rating field highlights the stars in yellow, like this:

image

 

However, on my new list, the stars would not turn yellow as we hovered over them so I knew something was wrong.

 

Troubleshooting steps

 

Knowing that the Rating feature relies on the User Profile Service, I checked in Central Admin under “Manage Services on Server” and verified that this service was running.  From the TechNet Share-n-dipity blog, I found an article which mentioned a specific timer job called “User Profile Service Application - Social Rating Synchronization Job” which is required for ratings to work.  So I checked my Timer Job Definitions and could not find this Timer job.  While this timer job is not specifically needed for the ratings stars to turn yellow, I took this as a hint that something was not quite right with the rating feature.

 

Therefore, my next move was to remove the Rating (0-5) and Number of Ratings columns from my library and then properly enable the Rating settings on my library.  While this did add the two rating columns back to my library, the rating stars still did not work when we hovered over them.  So my next test was to create a new library in the same site, and properly enable the ratings.  Sure enough, the rating stars worked perfectly.

 

I then went back to Central Admin and re-checked the Timer jobs, and the “User Profile Service Application - Social Rating Synchronization Job” was now there.  So my theory was that once this Timer job was created, it might then be ok to simply add the Rating (0-5) column to a library and have it work.  However, on my original library, the rating stars would not work either by disabling and re-enabling the Rating settings or by removing and re-adding the Rating (0-5) site column.

 

Finally, I created another new library which I did not enable the Ratings on, but I did add the the two rating site columns.  Sure enough, on this new library, the rating stars also worked properly.  I then repeated this test in a different web application in the same farm, and the rating stars worked properly there as well. 

 

So something about enabling the Rating feature properly the first time, sets the wheels in motion for the rating stars to work properly.  Obviously, it creates the necessary timer job, and I’m sure there is some other magic going on under the covers to make this work. 

 

 

Lessons Learned…

When you wish to utilize the ratings in a list or library, its best to always enable the normal “Rating settings”, rather than to directly add the Ratings site columns.  However, once you have properly enabled Ratings once on any list within the farm, it is may be ok to simply add the Rating (0-5) column into your new lists or libraries and expect the rating stars to work properly.  But do so at your own risk.

 

As for my existing list that I created before having enabled the Rating settings… well, I will likely need to re-create that list over again in order to get the ratings to work.


Tags: , ,

    Add a Comment

     [Quick Submit with Ctrl+Enter]