SharePoint = ScarePoint?

 In SharePoint

It shouldn’t scare the hell out of you

Search refiner missing in SharePoint 2013?
Yeah one of the cool features is that SharePoint, does know how many elements in certain refinement sections.
SharePoint 2010 did show of how could work.
And for example in Amazon everyone loves that feature, that shows you how many articles in a category.

Sooo I would say, lets turn that stuff on and make use of Powershell.

Create a Powershell Script with following content

param([Parameter(Mandatory = $true, Position = 0)][string] $siteUrl, [switch] $hide)
 
if ([string]::IsNullOrWhiteSpace($siteUrl))
{
    Write-Host -ForegroundColor red „Param -webUrl is required“
    return
}
 
Add-PSSnapin Microsoft.SharePoint.Powershell -Ea 0
 
$web = get-spweb $siteUrl
 
if (!$web)
{
    throw [string]::Format(„Web {0} does not exist. „, $siteUrl)
}
 
try
{
    $file = $web.GetFile(‚/_catalogs/masterpage/Display Templates/Filters/Filter_Default.html‘)
    $filter = [System.Text.Encoding]::ASCII.GetString($file.OpenBinary())
}
catch
{
    throw [string]::Format(„Refiner File does not exist. Exception: {0}“, $_.Exception)
}
$regex = [regex] ‚(ShowCounts: )(true|false)‘
 
if ($hide)
{
    $showCount = ‚false‘
}
else
{
    $showCount = ‚true‘
}
 
$filter = $filter -ireplace $regex, [string]::Concat(‚$1‘, $showCount)
$file.SaveBinary([System.Text.Encoding]::ASCII.GetBytes($filter))
 
if ($hide)
{
    $visibilty = „not visible“
}
else
{
    $visibilty = „visible“
}
 
Write-Host -ForegroundColor Green ([string]::Format( „Refiner Count is {1} for Site {0}“, $web.Url, $visibilty));

Turn it on with following params
yourscript.ps1 –siteUrl http://YourSharePointURL

Turn it of with following params
yourscript.ps1 –siteUrl http://YourSharePointURL -hide

Neueste Beiträge
SharePoint Konferenz 2015 Erding