Posts

Showing posts with the label Like

Powershell: Change Like and comments settings of a library

Hi, Recently I was working on the requirement to enable the like and comments settings of any library. So I prefer to use PowerShell script for same. I am sharing the code as below: function Change-SettingsForLikeComment() { # Change page library settings for Likes and comments $list=$web.Lists["Pages"]; if($list -ne $null) { Write-Host $list.Title "not null"; $assembly=[System.Reflection.Assembly]::Load("Microsoft.SharePoint.Portal, Version=15.0.0.0, 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", $fa...