Using the DropDown control in search panels

In the out of the box search mask you can search based on file extension. This simple control can also be used for searching all sorts of lists. All you need is a suitable managed property that returns results from a text search and you can implement a drop down search that returns items matching one, or several, criteria.

The file extension dropdown

How the Out-of-the-box control works.

<Control Name="FileExtension" Type="Dropdown" DisplayName="Result type" >
        <Item DisplayName="Word Documents" Value="doc;dot;docx;docm;dotx;dotm"/>
        <Item DisplayName="Emails" Value="msg;eml"/>
        <Item DisplayName="Excel Documents" Value="xls;xlt;xlsx;xlsm;xltx;xltm"/>
        <Item DisplayName="PowerPoint Documents" Value="pot;potm;potx;pps;ppsm;ppsx;ppt;pptm;pptx;"/>
        <Item DisplayName="PDF Documents" Value="pdf"/>
        <Item DisplayName="All Files" Value=""/>

FileExtension is a standard managed property created by SharePoint with which you can search for documents based on their file extension.

Word documents include various file extensions (doc, docx, dot, dotx, docm, dotm) so to combine them all a semicolon is used as a separator - Value="doc;dot;docx;docm;dotx;dotm".

Sample Document type dropdown

You may be sourcing your document types from a choice field, a managed metadata field, or even a BDC list. As long as you have a suitable managed property that returns results you can present a drop down control in your search mask. For example:

<Control Name="mvdoctype" Type="Dropdown" DisplayName="Document Type" >
        <Item DisplayName="Contract" Value="Contract"/>
        <Item DisplayName="Letter" Value="Letter"/>
        <Item DisplayName="Report" Value="Report"/>
        <Item DisplayName="Any Type" Value=""/>

Sample year based field dropdown

Perhaps you have a metadata item for the year of an item. The following is one way to present the same information as a drop down control that also allows users to combine documents from a couple of years.

<Control Name="ProgramYear" Type="Dropdown" DisplayName="Program Year" >
        <Item DisplayName="2013" Value="2013"/>
        <Item DisplayName="2013-2014" Value="2013;2014;"/>
        <Item DisplayName="2014" Value="2014"/>
        <Item DisplayName="2014-2015" Value="2014;2015"/>
        <Item DisplayName="All Files" Value=""/>

This approach also works if you make a text managed property from a date field as it will contain the year within it.

Sample dropdown for returning results from specific locations

<Control Name="Path" Type="Dropdown" DisplayName="Locations" >
        <Item DisplayName="Matters" Value="http://intranet/sites/matters/*"/>
        <Item DisplayName="Sales" Value="http://intranet/sites/sales/*"/>
        <Item DisplayName="All Files" Value=""/>

Related articles

Have more questions? Submit a request


Article is closed for comments.