You are here: Home » Enable Custom Search Scopes from code

Enable Custom Search Scopes from code

Posted by koning53
No Comments »

I was looking for some code to Enable Custom Scopes on a Site-Collection. I want to enable this from a feature instead of doing it manually for each site.

image

I couldn't find it fast on Google, so I tried to find out how `they' did it by using Reflector. It turned out it's easier than expected, just store the URL of the Search Center in a site-property and you're done:

[RootWeb].AllProperties["SRCH_ENH_FTR_URL"] = [URL to Search Center];[RootWeb].Update();

To disable the Custom Search Center:

[RootWeb].AllProperties["SRCH_ENH_FTR_URL"] = null;[RootWeb].Update();

Your email is never shared.
Required fields are marked *




Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>