0

I'm trying to alter the 'Site Collection Search Dropdown Mode' to show the search scopes drop down. I can achieve this via 'Site Settings' > 'Search Settings' but not through a sandbox solution.

I'm performing the following within the FeatureActivated function:

SPSite siteCollection = properties.Feature.Parent as SPSite;

if (siteCollection != null)
{  
    SPWeb topLevelSite = siteCollection.RootWeb;

    // Set the search dropdown ode to show the scopes dropdown.             
    topLevelSite.AllProperties["SRCH_SITE_DROPDOWN_MODE"] = "ShowDD";
    topLevelSite.Update();
 }

Any pointers would be appreciated.

1

Everything I've seen online also sets the SRCH_ENH_FTR_URL (Search Center URL) property as well as the dropdown mode. And I have done that (set both properties) in a feature receiver as well, and the scopes dropdown is set up correctly for me.

So, maybe you need to set the URL property in order for the scopes dropdown to activate? After all, if you go into the search settings in the UI, in the description for setting the Search Center URL, it says: "Once enabled, Search Boxes will show custom scopes to the user in the scopes dropdown."

Here are some examples of people setting more than one property to configure search:

An answer right on this site

MSDN blog

Another blog

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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