Remove the Search Box from SharePoint Sites
15-Aug-2008SharePoint 2007
Sometimes you don’t want your users to be able to search on your SharePoint site. Part one of this is then to remove your site from the content source in SSP, but you probably also want to remove the Search box from every page in your site.
Fortunately SharePoint makes this very easy.
The different version of SharePoint has different requirements for the Search box and the way these different serach boxes are implemented are using the Delegate feature of WSS.
Delegates are controls in a masterpage/page whose content is determined by which Features are activated.
Each Delegate has an ID (SmallSearchInutBox for the Search box) and each Feature can vote for it’s content by specifying an Control element.
For Delegates where AllowMultipleControls are false (like SmallSearchInputBox) the Control with the lowest sequence wins (25 is the lowest sequence used by OOB Feature).
So to disable the Search box all you have to do is implement a Feature which has a Control element with sequence below 25 pointing to an empty UserControls.
If you don’t want to develop this yourselves you can just download my implementation which makes a Feature with WebApplication scope.
The source files are here and a precooked solution file is here