Posts

Showing posts with the label comments

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...

Get Comment Count in SharePoint

Hi Guys, In this blog I will explain how we can get the number of comments on any page/article. Prerequisites for this blog are: a list with rating enabled, an article/page/splistItem already have got comments from users and a tool like VS to code ;) According to requirement it may be the case that one need to get item comment count using java script or c#. I will explain both way to get the comment count: Using Javascript: This may be the case when one want to use the content search webpart or CQWP to display comment count. Followng code can be use to get the comment Count: var linkURL = $getItemValue(ctx, "Link URL"); linkURL.overrideValueRenderer($urlHtmlEncode); // Get the Comments count var soapEnv = "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \ <soap:Body>    \ <CountCommentsOnUrl xmlns='http://mi...