Ask a questionAsk a question
 

AnswerProgrammatic Search Settings Configuration

  • Thursday, November 22, 2007 4:15 PMframue69 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

     

    I could need some help with a SharePoint administration script/program I want to code. Can someone tell me how to set the following WebUI setting programmatically?

     

    Site Settings > Site Collection Administration > Search Settings > Search Center

     

    Any help or feedback is appreciated.

     

    Thanks,

     

    Frank

Answers

  • Friday, November 23, 2007 12:32 AMGary LapointeMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    See the following post: http://stsadm.blogspot.com/2007/10/set-search-center.html.

     

    This is basically what you do:

    string url = "your site collection url";


    using (SPSite site = new SPSite(url))
    using (SPWeb web = site.RootWeb)
    {
    string searchCenter = "your search center url";
    web.AllProperties["SRCH_ENH_FTR_URL"] = searchCenter;
    web.Update();
    }

     

    Sometime I've found that the SDK documentation is less than helpful and tend to resort to disassembling the web pages that you'd hit when doing this via the browser.

All Replies