n
nRecently I was doing some R&D with the SharePoint Ratings and so thought to share my thoughts.
n
n
nAs we know that with the launch of SharePoint 2010 version, we got new social features like content tagging and content rating. For content ratings, we can rate the different contents in the list and libraries in range of 0 to 5.
n
nFor example: I have a publishing site and the pages library, so I need to have functionality such that the end users should be able to rate the pages inside the pages library.
n
nHow to do this?
n
nFor any list or library, there is a link to set the rating capability. When you go to the List and then in its settings, there you can see the link named as “Rating Settings”. After you click on that, a page opens where you can enable and disable this setting.
n
nOk so far so good. ? But what happens in the background?
n
nWell, I have observed that when you enable ratings on any list or library, the two Site Columns/Fields gets added to the SharePoint list. Obviously those get added to hold this rating as a metadata.
n
nWhich are those fields?
n
nField names are:
n
n Display Name Internal Name GUID
n
n1. Rating (0-5) AverageRating {5a14d1ab-1513-48c7-97b3-657a5ba6c742}
n
n2. Number of Ratings RatingCount {b1996002-9167-45e5-a4df-b2c41c6723c7}
n
n
n
nAnd here is the screen shot after enabling the rating on pages list
n
n
n
n
n
n
n
n
n
n
nRating is the asynchronous event and we talk about social features, they gets saved in social database which gets created when you have activated the user profile service application. So in short, to use rating you should have a user profile service running in your farm.
n
nThere is one timer job “User Profile Service Application – Social Rating Synchronization” job which by default runs after every hour and aggregates all the ratings.
n
n
n
n
n
nWhy ratings disappear after page refresh?
n
nI was also puzzled by a question that when we try to rate a page in pages library and then refresh the page, ratings given were disappearing. Why?
n
nSo answer is the Timer Job. As this job runs every hour, so unless and until the job has run and aggregated the ratings, we don’t see the ratings which were given. So I changed the job schedule to run every minute to have immediate effects.
n
nBut wait, there might be the case that If you have provisioned all the sites hierarchies very fine in the production environment and now request is to enable the ratings on all the lists and libraries in each site and subsites. Of course not manually right? So How to do that?
n
nYes you are right, you can write a feature, or a console application or any other approach which will enable rating setting recursively on each list and library within the site.
n
nBut again question now is how to do this programmatically?
n
nI will be posting this in part 2 of this post.
n
n