I have been followinf this http://msdn.microsoft.com/en-us/library/ms470880.aspx to create a delegate control to overide the default search used in Sharepoint. I am trying to make the search use a custom search scope called people. I don't seem able to do this. Could anyone please give me some tips?
Feature xml
<?xml version="1.0" encoding="utf-8"?>
<Feature
Id="9E16894A-998F-4928-97B3-FCB35EAD1C49"
Title="Standard User Interface Items"
Description="Provides several standard user interface components and links"
Version="12.0.0.0"
Hidden="TRUE"
DefaultResourceFile="core"
Scope="Web"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="controls\SearchArea.xml" />
</ElementManifests>
</Feature>
SearchArea.xml Enter text here Go!
mySearchArea.ascx
<%@ Control Language="C#" Inherits="Microsoft.SharePoint.WebControls.SearchArea,Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" compilationMode="Always" %>
<%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %>
<%
string strScopeWeb = null;
string strScopeList = null;
string strWebSelected = null;
SPWeb web = SPControl.GetContextWeb(Context);
string strEncodedUrl
= SPHttpUtility.EcmaScriptStringLiteralEncode(
SPHttpUtility.UrlPathEncode(web.Url + "/_layouts/searchresults.aspx", false, false)
);
strEncodedUrl = "'" + strEncodedUrl + "'";
strScopeWeb = "'" + SPHttpUtility.HtmlEncode( web.Url ) + "'";
SPList list = SPContext.Current.List;
if ( list != null &&
((list.BaseTemplate != SPListTemplateType.DocumentLibrary && list.BaseTemplate != SPListTemplateType.WebPageLibrary) ||
(SPContext.Current.ListItem == null) ||
(SPContext.Current.ListItem.ParentList == null) ||
(SPContext.Current.ListItem.ParentList != list))
)
{
strScopeList = list.ID.ToString();
}
else
{
strWebSelected = "SELECTED";
}
%>
<table border=0 cellpadding="0" cellspacing="0" class='ms-searchform'><tr>
<td>
<SELECT id='idSearchScope' name='SearchScope' class='ms-searchbox' title=<%SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SearchScopeToolTip),Response.Output);%>>
<OPTION value=<%=strScopeWeb%> <%=strWebSelected%>> <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,search_Scope_Site%>" EncodeMethod='HtmlEncode' Id='idSearchScopeSite'/> </OPTION>
<%
if (strScopeList != null)
{
%>
<OPTION value=<%=strScopeList%> SELECTED> <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,search_Scope_List%>" EncodeMethod='HtmlEncode' Id='idSearchScopeList'/> </OPTION>
<%
}
%>
</SELECT>
</td>
<td>
<INPUT Type=TEXT id='idSearchString' size=25 name='SearchString' display='inline' maxlength=255 ACCESSKEY=S class='ms-searchbox' onKeyDown="return SearchKeyDown(event, <%=strEncodedUrl%>);" title=<%SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SearchTextToolTip),Response.Output);%>>
</td>
<td>
<div class="ms-searchimage"><a target='_self' href='javascript:' onClick="javascript:SubmitSearchRedirect(<%=strEncodedUrl%>);javascript:return false;" title=<%SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SearchImageToolTip),Response.Output);%> ID=onetIDGoSearch><img border='0' src="/_layouts/images/gosearch.gif" alt=<%SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SearchImageToolTip),Response.Output);%>></a></div>
</td>
</tr></table>