Note that there are some explanatory texts on larger screens.

plurals
  1. POSharepoint Search Delegate Controls
    primarykey
    data
    text
    <p>I have been followinf this <a href="http://msdn.microsoft.com/en-us/library/ms470880.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms470880.aspx</a> 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?</p> <p>Feature xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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/"&gt; &lt;ElementManifests&gt; &lt;ElementManifest Location="controls\SearchArea.xml" /&gt; &lt;/ElementManifests&gt; &lt;/Feature&gt; </code></pre> <p>SearchArea.xml Enter text here Go! </p> <p>mySearchArea.ascx</p> <pre><code>&lt;%@ Control Language="C#" Inherits="Microsoft.SharePoint.WebControls.SearchArea,Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" compilationMode="Always" %&gt; &lt;%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %&gt; &lt;%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %&gt; &lt;%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %&gt; &lt;%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %&gt; &lt;%@ Import Namespace="Microsoft.SharePoint" %&gt; &lt;% 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 &amp;&amp; ((list.BaseTemplate != SPListTemplateType.DocumentLibrary &amp;&amp; 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"; } %&gt; &lt;table border=0 cellpadding="0" cellspacing="0" class='ms-searchform'&gt;&lt;tr&gt; &lt;td&gt; &lt;SELECT id='idSearchScope' name='SearchScope' class='ms-searchbox' title=&lt;%SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SearchScopeToolTip),Response.Output);%&gt;&gt; &lt;OPTION value=&lt;%=strScopeWeb%&gt; &lt;%=strWebSelected%&gt;&gt; &lt;SharePoint:EncodedLiteral runat="server" text="&lt;%$Resources:wss,search_Scope_Site%&gt;" EncodeMethod='HtmlEncode' Id='idSearchScopeSite'/&gt; &lt;/OPTION&gt; &lt;% if (strScopeList != null) { %&gt; &lt;OPTION value=&lt;%=strScopeList%&gt; SELECTED&gt; &lt;SharePoint:EncodedLiteral runat="server" text="&lt;%$Resources:wss,search_Scope_List%&gt;" EncodeMethod='HtmlEncode' Id='idSearchScopeList'/&gt; &lt;/OPTION&gt; &lt;% } %&gt; &lt;/SELECT&gt; &lt;/td&gt; &lt;td&gt; &lt;INPUT Type=TEXT id='idSearchString' size=25 name='SearchString' display='inline' maxlength=255 ACCESSKEY=S class='ms-searchbox' onKeyDown="return SearchKeyDown(event, &lt;%=strEncodedUrl%&gt;);" title=&lt;%SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SearchTextToolTip),Response.Output);%&gt;&gt; &lt;/td&gt; &lt;td&gt; &lt;div class="ms-searchimage"&gt;&lt;a target='_self' href='javascript:' onClick="javascript:SubmitSearchRedirect(&lt;%=strEncodedUrl%&gt;);javascript:return false;" title=&lt;%SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SearchImageToolTip),Response.Output);%&gt; ID=onetIDGoSearch&gt;&lt;img border='0' src="/_layouts/images/gosearch.gif" alt=&lt;%SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SearchImageToolTip),Response.Output);%&gt;&gt;&lt;/a&gt;&lt;/div&gt; &lt;/td&gt; &lt;/tr&gt;&lt;/table&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload