How can I programmatically set a Search Center site property on a SharePoint site?

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

How to do this programmatically?

+3
source share
1 answer

This parameter is stored in the properties 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();
}
+7
source

Source: https://habr.com/ru/post/1699187/


All Articles