The People Matches web part on search results pages can be very effective, however the default setting is to show only the persons name, job title and department.

What if you want more information in there such as the phone number so people that perform a search for someone in the organisation can see at a glance what number to phone for that particular person.

So to add the phone number you need to first edit the search results page (typically located as Results.aspx within Search Centre), then edit the People Matches web part.

Untick the box for “Use Location Visualization”.

Now click on the XSL Editor.

Add a new variable name …

<xsl:variable name=”haswp”        select=”string-length(workphone) &gt; 0″/>

Then add the following code at the end of the “ContactInfo” section:

      <xsl:if test="$haswp">
        <li id="WorkPhoneField">
          <xsl:apply-templates select="hithighlightedproperties/workphone" />
        </li>
      </xsl:if>

So that the “CoontactInfo” section looks like this:

  <div id="ContactInfo">
    <ul id="MiniContactCard">
      <li id="NameField">
        <xsl:if test="$haspn">
          <a href="{ddwrt:EnsureAllowedProtocol(string($url))}" id="{concat($currentId, '_CSR')}">
            <xsl:apply-templates select="hithighlightedproperties/preferredname" />
          </a>
        </xsl:if>
      </li>
      <xsl:if test="$hasydn">
        <li id="YomiField">
          <xsl:apply-templates select="hithighlightedproperties/yomidisplayname" />
        </li>
      </xsl:if>
      <xsl:if test="$hasjt">
        <li id="JobTitleField">
          <xsl:apply-templates select="hithighlightedproperties/jobtitle" />
        </li>
      </xsl:if>
      <xsl:if test="$hasdp">
        <li id="DepartmentField">
          <xsl:apply-templates select="hithighlightedproperties/department" />
        </li>
      </xsl:if>
      <xsl:if test="$haswp">
        <li id="WorkPhoneField">
          <xsl:apply-templates select="hithighlightedproperties/workphone" />
        </li>
      </xsl:if>
    </ul>   
  </div> 
 
Save and publish the page and the work phone details should appear when you perform a new search for someone in the organisation.

To add any other user profile data it should be a simple case of making up a variable as above and copying (and changing) the new part of the ContactInfo section with the correct name for the field in the user profile.


Advertisements