Category Archives: SharePoint

Export Query Rules Best Bets using PowerShell – SharePoint 2013

Published / by / Leave a Comment

Without using any custom code, Search service application administrators, site collection administrators, and site owners can help searches respond to the intent of users by creating query rules. In a query rule, you specify conditions and correlated actions. When a query meets the conditions in a query rule, the search system performs the actions specified in the rule to improve the relevance of the search results, such as by narrowing results or changing the order in which results are displayed.

We all know how hard it is to manage these one by one. Exporting these query rules to Excel, making the modifications and importing from Excel would save tremendous amount of time for Administrators.

Add-PSSnapin Microsoft.Sharepoint.Powershell;
$siteUrl = "";
$resultSourceName = "Local SharePoint Results";
$site = Get-SPWeb $siteUrl;
$web = Get-SPWeb $siteUrl;
$searchServiceApplication = Get-SPServiceApplication -Name "Search Service";
$searchOwner = New-Object Microsoft.Office.Server.Search.Administration.SearchObjectOwner -ArgumentList @([Microsoft.Office.Server.Search.Administration.SearchObjectLevel]::SPSite,$site);
$searchObjectFilter = New-Object Microsoft.Office.Server.Search.Administration.SearchObjectFilter($searchOwner);
$queryRuleManager = New-Object Microsoft.Office.Server.Search.Query.Rules.QueryRuleManager($searchServiceApplication);
$queryRules = $queryRuleManager.GetQueryRules($searchObjectFilter);
$level = "SPWeb"
$searchObjectOwner = New-Object Microsoft.Office.Server.Search.Administration.SearchObjectOwner($level, $web)
$searchObjectFilter = New-Object Microsoft.Office.Server.Search.Administration.SearchObjectFilter($searchObjectOwner)
$federationManager = New-Object Microsoft.Office.Server.Search.Administration.Query.FederationManager($searchServiceApplication)
$resultSource = $federationManager.GetSourceByName($resultSourceName,$searchObjectOwner)
$queryRules = $queryRuleManager.GetQueryRules($searchObjectFilter)
$promotedResultCollection = $searchServiceApplication.GetBestBets($searchObjectFilter)
$customQueryRules = $queryRuleManager.GetQueryRules($searchObjectFilter) | ?{$_.Owner.Level -ne $searchServiceApplication}
Write-Host "There are" $customQueryRules.Count "Customised Query Rules"
"Title `t Url `t Keywords `t Description" | out-file ExportQueryRules.csv
foreach($qryRule in $customQueryRules)
#Write-Host "Exporting Query Rule " $qryRule.DisplayName
#$queryAction = $qryRule.CreateQueryAction([Microsoft.Office.Server.Search.Query.Rules.QueryActionType]::AssignBestBet)
$termstring ="";
foreach ($term in $qryRule.QueryConditions.Terms)
$termstring += $term +";";
foreach ($bestbet in $qryRule.AssignBestBetsAction.BestBetIds)
$promotedResultCollection[$bestbet].Title + "`t" + $promotedResultCollection[$bestbet].Url.OriginalString+ "`t" +$termstring+ "`t" + $promotedResultCollection[$bestbet].Description | Out-File ExportQueryRules.csv -Append

SharePoint error “Cannot complete this operation” – Creating site from site tempalte

Published / by / Leave a Comment

The SharePoint application pages under the layouts folder uses the web.config file at the following location. Default timeout is 3600 and increase it will make the execution complete successfully. 

Location: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS

[wc_highlight color=”blue”]<httpRuntime executionTimeout=”18000″ />[/wc_highlight]


[wc_box color=”primary” text_align=”left”]

If you are using Physical Load Balancer like F5 then check for LANTIMEOUT, WANTIMEOUT and adjust them appropriately.




SharePoint 2010: User Not Found error

Published / by / Leave a Comment

Accessing SharePoint workflows or creating new ones gives an error “User Cannot be found” , This can happen when the user account is no longer in Active Directory.

The workaround for this to to republish the workflow through SharePoint Designer 2010

  • Open site in SharePoint Designer 2010.
  • Click on the Workflows from the Site Objects menu.
  • Select the workflow and Publish
  • Repeat this for all the workflows.


Sometimes opening the workflows and republishing them doesn’t work, these workflows might stuck with old user and republishing them don’t work.


  • Deactivated workflow features at the site collection level
  • Open the site within SharePoint Designer
  • All files > _catalog > wfpub >
  • Deleted all the existing workflows
  • Reactivated Workflow features at the site collection level which will recreate the OOB workflows
  • All users are now able to access workflow settings and publish a workflow without any issues



Published / by / Leave a Comment

I’m working on implementing Remote Blob storage for one of our clients and the below is an ROI estimate for 12TB of content in a SharePoint environment. RBS reduces accumulating storage costs and optimizes platform performance for Microsoft SharePoint.

Remote BLOB shatters the 2 GB limit. If you have large CAD files, videos or project files that you want to store in SharePoint remote BLOB can be used to upload and manage these files.


Remote BLOB storage estimation

Remote BLOB storage estimation

SharePoint 2010: How to Increase the file size of Attachment in Infopath forms

Published / by / Leave a Comment
  • Go to Central Administration
  • Select the Web Application then open Web Application general settings
  • Set Maximum Upload Size, if necessary
  • Go back to Central Admin & open configure info-path form services under info-path form services
  • Set Form Session State –> Maximum size of form session state value to required (ex: 51200KB – the default is 4096KB).