Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the site collection search results page in Sharepoint 2010?

There's a "Site Collection Search Results Page" field which is used for configuring the search results page used for contextual searches (such as "This Site"). It can be found by doing the following:

  1. Go to your SharePoint site collection
  2. Select "Site Settings" from the "Site Actions" menu
  3. Go to the "Site Collection Administration" section and select "Search Settings"
  4. The field "Site Collection Search Results Page" will be listed on the bottom.

The default value is

/_layouts/osssearchresults.aspx

How can I retrieve and change this value through the SharePoint object model?

like image 221
Alexander Avatar asked Jul 22 '10 07:07

Alexander


1 Answers

The setting is stored in:

site.RootWeb.AllProperties["SRCH_TRAGET_RESULTS_PAGE"] 

If doesn't exist or is null then '/_layouts/osssearchresults.aspx' is used

The Search Center URL is in

site.RootWeb.AllProperties["SRCH_ENH_FTR_URL"] 

And the drop down mode in

site.RootWeb.AllProperties["SRCH_SITE_DROPDOWN_MODE"] 
like image 120
Per Jakobsen Avatar answered Sep 30 '22 20:09

Per Jakobsen