Welcome to MSDN Blogs Sign in | Join | Help

Ram's Blog

Blogging about SharePoint experiences

News



  • Disclaimer
    These postings are provided "AS IS" with no warranties and confer no rights. In addition, these postings are my own views and do not represent the views of Microsoft.

Hiding Search Scopes Dropdown in Site Master Page

When I was looking to implement this for one of the SharePoint sites I worked on, I never was able to find a step by step instructions. Here is exact steps to hide scopes drop down in site master page

Under your Features folder look for "OSearchBasicFeature" folder and copy and rename this to say for ex "SearchBasicFeatureWithOutContextualScope" 

Edit the feature.xml file and replace the  id and title, you can generate a new id by using the Generate GUID tool in Visual Studio. Here is what my customized feature file looks like

<?xml version="1.0" encoding="utf-8" ?>

<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->

<Feature  Id="601D5F49-A45E-4c58-B14B-829AB593C4BC"

          Title="SearchBox with no contextual scope"

          Description="$Resources:BasicSearch_Feature_Description;"

          DefaultResourceFile="spscore"

          Version="12.0.0.0"

          Scope="WebApplication"

          ReceiverAssembly="Microsoft.Office.Server.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"

          ReceiverClass="Microsoft.Office.Server.Search.Administration.BasicSearchFeatureReceiver"

          xmlns="http://schemas.microsoft.com/sharepoint/">

 

    <ElementManifests>

        <ElementManifest Location="searcharea.xml"/>

    </ElementManifests>

</Feature>

Next up open the SearchArea.xml file in Visual Studio and change the dropdownmode property to "HideDD_useDefaultScope", Here is what my customized searcharea.xml looks like

<?xml version="1.0" encoding="utf-8" ?>

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

    <Control

        Id="SmallSearchInputBoxWithOutContextualScope"

        Sequence="50"

        ControlClass="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx" ControlAssembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">

      <Property Name="GoImageUrl">/_layouts/images/gosearch.gif</Property>

      <Property Name="GoImageUrlRTL">/_layouts/images/twg/goRTL.gif</Property>

      <Property Name="GoImageActiveUrl">/_layouts/images/gosearch.gif</Property>

      <Property Name="GoImageActiveUrlRTL">/_layouts/images/goRTL.gif</Property>

      <Property Name="DropDownMode">HideDD_useDefaultScope</Property>

      <Property Name="SearchResultPageURL">/_layouts/osssearchresults.aspx</Property>

      <Property Name="ScopeDisplayGroupName"></Property>

      <Property Name="FrameType">None</Property>

      <Property Name="ShowAdvancedSearch">false</Property>

    </Control>   

</Elements>

 

Install the feature.

Stsadm –o installfeature –filename SearchBasicFeatureWithOutContextualScope\Feature.xml

 

Activate the feature for web application

Stsadm –o activatefeature –filename SearchBasicFeatureWithContextualScope\Feature.xml –url {your web application url}

In your master page look for content place holder PlaceHolderSearchArea and change the ControlID attribute of SharePoint Delegate control to “SmallSearchInputBoxWithOutContextualScope”

Here is an example markup from my master page

 

<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">

         <!--SmallSearchInputBox -->

         <SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBoxWithOutContextualScope" />

</asp:ContentPlaceHolder>

 

 

Posted: Thursday, June 26, 2008 10:47 PM by ramg

Comments

nlvraghavendra said:

Can't we directly set the property in the master page as "DropDownMode = "HideDD_useDefaultScope" ?

# August 29, 2009 4:35 AM

crucial said:

or just set the CSS...

.ms-sbcopes {

    display:none;

}

# September 23, 2009 9:40 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker