Tuesday, 13 September 2011

AllProperties and the Search Center case

SPWeb.AllProperties contains all the properies of the website. MSDN defines AllProperties like this: Gets a hash table that contains metadata for the website.

One of the most interesting properties is SRCH_ENH_FTR_URL , this property allows you to specify the search centre required. You can do all of this programmatically, have a look the code:

using (SPSite _sSite = new SPSite(@"http://sharepointsite"))
   using (SPWeb _wWeb = _sSite.OpenWeb())
      _wWeb.AllProperties["SRCH_ENH_FTR_URL"] = @"http://sharepointsite/searchcenter";


No comments: