SharePoint 2010: How to change rating icons

By | December 27, 2010

English:

Sometimes you may received a request to change rating icons, from a normal star to a love icon. So, how would you do it?

OriginalRating
Figure 1. Original rating icons

LoveRating
Figure 2. Modified love rating icons

1. Find and prepare rating icons.  In this case I will need to prepare 4 styles rating icons

TitleSampleSize
a. Empty Ratinglove_ratingempty16×16
b. Selected Ratinglove_RatingsNew16×16
c. Rating Overlaylove_ratings448×16
d. Rating Overlay RightToLeftlove_Ratingsrtl448×16

2. Save the new icons under 14 hive\Images.

3. Create script to modify SPWeb property bag. To ease our job, I will use PowerShell script as follows,

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”) > $null

$spSite
= new-object Microsoft.SharePoint.SPSite(“
http://win2k8″);
$spWeb = $spSite.OpenWeb();

$spWeb.Properties[“Ratings_NewRatingIconUrl”] = “/_layouts/Images/love_RatingsNew.png”;
$spWeb.Properties[“Ratings_EmptyIconUrl”] = “/_layouts/Images/love_RatingsEmpty.png”;
$spWeb.Properties[“Ratings_ImageStripUrl”] = “/_layouts/Images/love_Ratings.png”;
$spWeb.Properties[“Ratings_ImageStripRtlUrl”] = “/_layouts/Images/love_Ratingsrtl.png”;

$spWeb.Properties.Update();
$spWeb.Dispose();
$spSite.Dispose();

iisreset

4. Voila ! And you can refresh your browser to see the changes.

5. Finally you can distribute your solution into a solutions package with feature activation events to register/un-register custom rating images.

2 thoughts on “SharePoint 2010: How to change rating icons

Leave a Reply