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.
- In central admin go to Application Management > Manage service Applications
- Select User Profile Default SA and click the Manage User Properties
- Select New Property and fill in the details as bellow

- Once this has been done Run a full crawl.
- Navigate to the Search site on the site collection
- Edit the page and edit the “People Search Core Results” web part
- Open the “display properties” menu and uncheck the “Use Location Visualization” checkbox
- Click the “XSL Editor” button
- Search for the line <xsl:variable name=”haswph” select=”string-length(workphone) > 0″/> and add this line of xsl after it on the line bellow <xsl:variable name=”haste” select=”string-length(telephoneextension) > 0″/>
- 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>
- 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
Written by Al Roome
Leave a comment