SharePoint 2010: Set Site Collection Search Center URL with C#

In a previous post I showed how you can easily set the search scope drop down for a SharePoint 2010 site collection using C#.   Setting the site collection search center URL is just as easy.

After getting a reference to a SPWeb object you just need to set the value of the SRCH_ENH_FTR_URL key in the AllProperties collection to the search center URL.  Example:

web.AllProperties[“SRCH_ENH_FTR_URL”] = “http://intranet/search/pages”;

That’s all there is too it! 

Leave a Reply