Archive for June, 2013

Enable Rating or Likes Settings in SharePoint 2013

June 19, 2013 8 comments

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 "";
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));#>