SharePoint people search set up for custom search property


On a recent project I was asked to add a custom column to the people search results and thought I’d share the steps. The column name was for the Telephone Extension, change this in the code bellow with your column name.

  1. In central admin go to Application Management > Manage service Applications
  2. Select User Profile Default SA and click the Manage User Properties
  3. Select New Property and fill in the details as bellow

Untitled-1

  1. Once this has been done Run a full crawl.
  2. Navigate to the Search site on the site collection
  3. Edit the page and edit the “People Search Core Results” web part
  4. Open the “display properties” menu and uncheck the “Use Location Visualization” checkbox
  5. Click the “XSL Editor” button
  6. Search for the line  <xsl:variable name=”haswph”       select=”string-length(workphone) &gt; 0″/> and add this line of xsl after it on the line bellow <xsl:variable name=”haste”       select=”string-length(telephoneextension) &gt; 0″/>
  7. Then search for this few lines of code

<xsl:if test=”$haswph”>
<li id=”PhoneField”>
<xsl:apply-templates select=”hithighlightedproperties/workphone” />
</li>
</xsl:if>

And add the following below it


<xsl:if test=”$haste”>
<li id=”TelephoneExtension”>
<xsl:choose>
<xsl:when test=”hithighlightedproperties/telephoneextension”>
<xsl:call-template name=”HitHighlighting”>
<xsl:with-param name=”hh” select=”hithighlightedproperties/telephoneextension” />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=”telephoneextension” />
</xsl:otherwise>
</xsl:choose></li>
</xsl:if>

  1. Save and then edit the properties window above the xsl editor option . select all and add this code over it removing the present code with the code listed bellow

<Columns>         <Column Name=”WorkId”/>      <Column Name=”UserProfile_GUID”/>                <Column Name=”AccountName”/>           <Column Name=”PreferredName”  HitHighLight=”true”/>            <Column Name=”YomiDisplayName” HitHighLight=”true”/>           <Column Name=”JobTitle” HitHighLight=”true”/>                 <Column Name=”Department” HitHighLight=”true”/>   <Column Name=”WorkPhone”  HitHighLight=”true”/>    <Column Name=”TelephoneExtension”  HitHighLight=”true”/> <Column Name=”OfficeNumber” HitHighLight=”true”/> <Column Name=”PictureURL”/>               <Column Name=”HierarchyUrl”/>               <Column Name=”WorkEmail”  HitHighLight=”true”/>       <Column Name=”Path”/>                 <Column Name=”HitHighlightedSummary”/>     <Column Name=”HitHighlightedProperties”/>   <Column Name=”Responsibility” HitHighLight=”true”/>    <Column Name=”Skills” HitHighLight=”true”/>   <Column Name=”SipAddress” HitHighLight=”true”/>         <Column Name=”Schools” HitHighLight=”true”/>             <Column Name=”PastProjects” HitHighLight=”true”/>      <Column Name=”Interests” HitHighLight=”true”/>          <Column Name=”OrgNames” HitHighLight=”true”/>          <Column Name=”OrgUrls”/>      <Column Name=”OrgParentNames” HitHighLight=”true”/>            <Column Name=”OrgParentUrls”/>        <Column Name=”Memberships” HitHighLight=”true”/>   <Column Name=”AboutMe” HitHighLight=”true”/>         <Column Name=”BaseOfficeLocation” HitHighLight=”true”/>         <Column Name=”ServiceApplicationID”/>           <Column Name=”SocialDistance”/> </Columns>

12.   Once this is done and the search crawl is finished save the page and search for a person making sure their profile has the Telephone Extension property filled in

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s