我試圖更新的SharePoint 2013磨漿機的WebPart直通下面的PowerShell腳本:的Sharepoint 2013 SelectedRefinementControlsJson拋出錯誤
$spweb = Get-SPWeb "http://da-server/search/"
$page = $spweb.GetFile("Pages/results.aspx")
$page.CheckOut()
# Find the Refinement web part
$webPartManager = $spweb.GetLimitedWebPartManager("http://da- server/search/Pages/results.aspx", [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
$rwp = $webpartmanager.webparts | ? { $_.title -eq 'Refinement' }
# Refiners are updated by changing the JSON
$j = $rwp.SelectedRefinementControlsJson | ConvertFrom-Json
$j.refinerConfigurations | % { if ($_.propertyName -eq 'LastModifiedTime') { $_.displayName = 'Mod Time'; }
**$rwp.SelectedRefinementControlsJson = ConvertTo-Json $j -Compress** This line throwing the error.
# Save our changes
$webpartmanager.SaveChanges($rwp) # save changes to webpart
$page.CheckIn('Changed last mod refiner')
$page.Publish('Changed last mod refiner')
上述突出線10拋出下面的錯誤:
Exception setting "SelectedRefinementControlsJson": No parameterless constructor defined for type of 'Micrososft.Office.Server.Search.WebControls.RefinementControl[]'"