Installation

  • Deploy the solution package "SearchExtension.wsp"
  • Activate the SearchExtension site-level feature - this will add the SearchExtension web part to the gallery
  • Add the SearchExtension web part to a page which has the "Advanced Search" web part present. The web-part will locate any instances of Advanced Search webpart on the page, and will extend the functionality.
  • Configure the SearchExtension webpart: see below

 

Configuring the SearchExtension webpart

The SearchExtension web part has one text box for its configuration XML.

Here is an example of the configuraton XML used to create Categories and Sub-categories,

 

<Configuration>
    <CustomPropertyRestrictionControls>
        <ControlMapping OptionText="Category" ControlToUse="Dropdownlist" 
          SourceList="Categories" SourceListParentWeb="TStester" 
          ItemDisplayTextColumn="Title" ItemValueColumn="Title"
          ChildrenOptionText="Sub Category" DependentOnOptionText="" DependentOnType="" 
          DuplicateAddedAlert="This property can not be selected more than once!" 
          ExpandedWidth="Auto" />
        <ControlMapping OptionText="Sub Category" ControlToUse="Dropdownlist" 
          SourceList="Categories" SourceListParentWeb="TStester" ItemDisplayTextColumn="Title" 
          ItemValueColumn="Title" ChildrenOptionText="" DependentOnOptionText="Category" 
          DependentOnType="ParentFolder" 
          DuplicateAddedAlert="This property can not be selected more than once!" 
          ExpandedWidth="Auto" />
        <ControlMapping OptionText="SharedInformation" ControlToUse="Dropdownlist">
            <Option text="Yes" value="1" />
            <Option text="No" value="0" />
        </ControlMapping>
    </CustomPropertyRestrictionControls>
    <SecurityTrimmings>
        <SecurityTrim OptionText="Query Status (Superceded)" 
          Groups="TSApprovers,TSAdministrators,TSApplicationAdministrators,TSSharedInformationApprovers" 
          TeamSiteUrl="/TStester" />
    </SecurityTrimmings>
</Configuration>

 

Points to note:

  • OptionText: property relates to the display text of the property in the property restriction dropdown lists
  • ControlToUse: Dropdownlist is the only option available
  • SourceList: Source list for dropdownlist options (List iternal name or GUID)
  • SourceListParentWeb: This points to the site which contains the SourceList. This value must be either a site-relative URL such as "sitecollection/subsite" or "sitecollection" or a site GUID. The site must belong to the same site collection as where the search extension webpart resides. For reference, the team site is obtained using the SPSite.AllWebs[str] property. See documentation on the AllWebs collection.
  • ItemDisplayTextColumn: text to display
  • ItemValueColumn: the value column -this is the value that will be passed when searching (ie, passed in the background to the old un-used free text box)
  • ChildrenOptionText: Child option display text
  • DependentOnOptionText: Parent option display text - links parent-child relationship
  • DependentOnType: ParentFolder is the only available option. When the callback occurs, it will search items within the folder (at the root) whose name corresponds with the selected value of the parent
  • DuplicateAddedAlert: The message displayed if the property has been selected more than once
  • ExpandedWidth: Relevant for IE only. In IE, the dropdownlists do not expand to accommodate items that take up more space than the width of the dropdown list. When set to "Auto", dropdowns will be resized to accommodate the largest item when expanded. Hard-coded values can be used instead such as "350px". Must be either "Auto" or a valid css width.

Required nodes in the configuration XML:

  • Root node "Configuration" is required
  • CustomPropertyRestrictionControls node is required even if empty it must be included.
  • SecurityTrimmings node is required even if it is empty it must be included.
<Configuration>
    <CustomPropertyRestrictionControls>
        <ControlMapping OptionText="Category" ControlToUse="Dropdownlist"
          SourceList="Categories" SourceListParentWeb="TStester"
          ItemDisplayTextColumn="Title" ItemValueColumn="Title"
          ChildrenOptionText="Sub Category" DependentOnOptionText="" DependentOnType=""
          DuplicateAddedAlert="This property can not be selected more than once!"
          ExpandedWidth="Auto" />
        <ControlMapping OptionText="Sub Category" ControlToUse="Dropdownlist"
          SourceList="Categories" SourceListParentWeb="TStester" ItemDisplayTextColumn="Title"
          ItemValueColumn="Title" ChildrenOptionText="" DependentOnOptionText="Category"
          DependentOnType="ParentFolder"
          DuplicateAddedAlert="This property can not be selected more than once!"
          ExpandedWidth="Auto" />
        <ControlMapping OptionText="SharedInformation" ControlToUse="Dropdownlist">
            <Option text="Yes" value="1" />
            <Option text="No" value="0" />
        </ControlMapping>
    </CustomPropertyRestrictionControls>
    <SecurityTrimmings>
        <SecurityTrim OptionText="Query Status (Superceded)"
          Groups="TSApprovers,TSAdministrators,TSApplicationAdministrators,TSSharedInformationApprovers"
          TeamSiteUrl="/TStester" />
    </SecurityTrimmings>
</Configuration>

Last edited Dec 14, 2012 at 5:03 AM by Rsteller, version 6

Comments

No comments yet.