Home > Microsoft SharePoint, SharePoint2013 > Enable Rating or Likes Settings in SharePoint 2013

Enable Rating or Likes Settings in SharePoint 2013

Hi Friends,

It was a tough time to find the PowerShell or a C# API to enable or disable Rating/Likes Settings in SharePoint 2013. I found a helpful post from Nanddeep for c# equivalent. I have converted it in PowerShell, hope this will help some of SharePoint developers and admins.

Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue

$web=Get-SPWeb "http://abc.com/test";
if($list -ne $null)
 Write-Host $list.Title "not null";
 $assembly=[System.Reflection.Assembly]::Load("Microsoft.SharePoint.Portal, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
 $reputationHelper =$assembly.GetType("Microsoft.SharePoint.Portal.ReputationHelper");

$bindings = @("EnableReputation", "NonPublic", "Static");
 [System.Reflection.BindingFlags]$flags = [System.Reflection.BindingFlags]::Static -bor [System.Reflection.BindingFlags]::NonPublic;

 $methodInfo = $reputationHelper.GetMethod("EnableReputation", $flags);

#For enabling Ratings
 $values = @($list, "Ratings", $false);

#OR for enabling Likes
 #$values = @($list, "Likes", $false);

$methodInfo.Invoke($null, @($values));

 #For disable Rating or Likes
 <#$methodInfo = $reputationHelper.GetMethod("DisableReputation", $flags);
 $disableValues = @($list);
 $methodInfo.Invoke($null, @($disableValues));#>
  1. Vijay
    June 19, 2013 at 9:02 am

    Reflection way is very powerful and can be used in multiple scenarios including this one 🙂 it’s kind of backdoor entry into SharePoint APIS 😉

  2. October 24, 2013 at 8:41 pm

    When using publishing web add follwing lines after line that starts with $web and delete line $list

    [bool]$IsPublishingWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::IsPublishingWeb($web)
    $pweb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
    $list = $pweb.PagesList

  3. May 6, 2015 at 8:19 am

    Its not working for SharePoint Online. Is there any other alternative for the same

  4. May 15, 2015 at 12:49 pm

    Hi Shrikantss,

    I never tried it on online.

  5. Philippe B.
    October 11, 2015 at 7:24 pm

    Waoo! Looks like hokus pokus for me but it works fine. Thank you.

  6. Yura
    July 30, 2019 at 11:23 am

    Awesome! Thank you very much! From Russia with love

  1. November 9, 2016 at 12:19 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: