Provision Search Navigation Settings PnP PowerShell

I was investigating ways how to provision a search centre site with all the configurations automatically. I tried to package all configurations from an already configured Search Centre using “Save site as template”, however it did not work as Publishing Features are activated in a Search Centre.

There are different configuration elements in a search centre site

  • Search Navigation Settings
  • Custom Search Display Templates
  • Custom Search Results Pages which can be created using the function Add-PublishingPage 
  • Configure web parts in the search results page
    • Refinement WebPart
    • Search Results WebPart

This blog post focuses on updating the Search Navigation Settings. I have been experimenting using PnP method Add-SPONavigationNode. Prior to PnP September 2016 release, when the method was used, it was throwing the error message

Add-SPONavigationNode : Invalid URI: The format of the URI could not be determined.

Fortunately it was fixed with PnP September 2016 release.

I have created the method Update-SearchNavigationNode() to handle the update .

  1. The Search Navigation Nodes are retrieved using Id 1040
  2. All Existing Navigation Nodes are deleted using PnP method Remove-SPONavigationNode
  3. The Search Navigation Nodes are added using method  Add-SPONavigationNode  providing the values for parameters Title, Url,Location and Header.

Add-SPONavigationNode -Title "site directory " -Url "/search/Pages/SomePageName.aspx" -Location "SearchNav" -Header "SearchNav"

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s