views:

599

answers:

1

I have a site collection and I want to set the search center value to be the same as another site collection. The site collection is created in code, so I need to be able to set the property after the site collection has been created.

How can I do this programatically?

+4  A: 

This setting is stored in the property bag of the SPWeb object. You can update it as follows:

using (SPSite site = new SPSite("http://server/site"))
using (SPWeb web = site.OpenWeb())
{
  web.AllProperties["SRCH_ENH_FTR_URL"] = "/searchcenter/pages";
  web.Update();
}
Lars Fastrup