SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to use code behind to set the search settings of my site:

  • The Site Collection Search Center Url
  • Site Collection Search Dropdown Mode: Show Scopes Dropdown

Any ideas on how to implement this?

share|improve this question
up vote 4 down vote accepted

This is done by modifying properties on the Root Web property bag. Here's a PowerShell sample that I've used to set the same settings on all site collections:

$url = "http://rockingsharepointserver"
Get-SPSite  -Limit ALL | foreach{ 
    IF($_.RootWeb.AllProperties -ne $null) {
        $_.RootWeb.AllProperties["SRCH_SITE_DROPDOWN_MODE"] = "ShowDD"
        $_.RootWeb.AllProperties["SRCH_ENH_FTR_URL"] = "$url/sites/Search/Pages"
        Write-Host -ForeGroundColor blue Updated Search settings for $_.RootWeb.Url

The easiest way to find out what values you should be using is to configure one site collection and then use SharePoint Designer to inspect the properties (Ribbon > Manage > Site Options)

share|improve this answer
Very useful information! Thanks Wictor! – Wim Hill May 30 '11 at 11:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.