rss

Sharepointology

Sharepointology is the study and handling of Microsoft Office SharePoint Server

Customize the People Search Results – Part 2

Posted 12Oct08 by Erwin in Development

In Customize the People Search Results – Part 1 we learned how to pimp the search results from looking something like this:

People Search Default Results

To something like this:

People Search New Results

In Part 2 we are going to learn how to add other fields (properties) to the Search results.

How do we do this?

Let’s first include the Mobile phone of a user into the XML list of results returned by the search service.

  • First you go to your People Search Page and execute a search on a certain name for wich you know you will find results.
  • On the results page you click on Site Actions / Edit page.
  • For the People Search Core Results web part you choose Modify Shared Web Part.

People Search Core Results Edit Web Part

  • Open the Results Query Options by pressing on the + sign in front of it.
  • Look up the Selected Columns field and press the [...] button and you’ll get this:
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Columns>
<Column Name="AccountName"/>
<Column Name="UserProfile_GUID"/>
<Column Name="PreferredName"/>
<Column Name="JobTitle"/>
<Column Name="Department"/>
<Column Name="WorkPhone"/>
<Column Name="OfficeNumber"/>
<Column Name="Fax"/>
<Column Name="AboutMe"/>
<Column Name="PictureURL"/>
<Column Name="WorkEmail"/>
<Column Name="WebSite"/>
<Column Name="Path"/>
<Column Name="HitHighlightedSummary"/>
<Column Name="HitHighlightedProperties"/>
<Column Name="Responsibility"/>
<Column Name="Skills"/>
<Column Name="SipAddress"/>
</Columns>
</root>
  • Now you’ll be able to include new columns based on the columns you can reference from the user profile database. For example if you wanted to include a person’s mobile phone you’ll want to include <Column Name=”MobilePhone”/>. After you’ve done that the XML getting returned by the Search has the MobilePhone column in it.
  • Where do you find these column names? Go to your Central Administration, click Shared Services, then Search Settings and click Metadata property mappings.

Meta Data Property Mappings

  • You’ll find the column names in the column Property Name.

Metadata Property Mobilephone

Now we’ll have to change the XSLT to include the MobilePhone column as output.

  • Choose Modify Shared Web Part for the People Search Core Results web part. If you don’t know how to do this look up a few lines.
  • Just below Data View Properties you see a XSL Editor button. Press it.
  • Search for “Phone” and you’ll find a line containing  <xsl:with-param name=”phone” select=”workphone” />.
  • Copy that line and change the new line to  <xsl:with-param name=”mobile” select=”mobilephone” />.
  • Keep searching for “Phone” and you’ll find the following line <xsl:param name=”phone” />.
  • Copy it and change the new line to <xsl:param name=”mobile” />.
  • Search again and you’ll find:
<xsl:if test='string-length($phone) > 0'>
<tr>
<td><b>Telefoon nr: </b></td>
<td><xsl:value-of select="$phone" />  </td>
</tr>
</xsl:if>
  • Copy and change to:
<xsl:if test='string-length($mobile) > 0'>
<tr>
<td><b>Mobiel nr: </b></td>
<td><xsl:value-of select="$mobile" />  </td>
</tr>
</xsl:if>
  • Save it, publish the page and retry your Person Search and you’ll get something like this:

People Search New Results Mobilephone

 

  1. Customize the People Search Results – Part 1
  2. Dropdown to change the View disappeared
  3. Add Web Parts to DispForm, EditForm or NewForm.aspx
  4. Microsoft SharePoint Designer 2007 is now FREE

RSSIf you like this post then please consider subscribing to my full feed RSS. You can also subscribe by Email and have new posts sent directly to your inbox.

7 Responses

  1. Links (10/12/2008) « Steve Pietrek - Everything SharePoint

    [...] Customize the People Search Results – Part 2 [...]

  2. Add other fields (properties) to the Search results. « Microsoft Technology, .Net, BizTalk, Sharepoint & etc.

    [...] by ken zheng on April 17, 2009 I have followed this blog to add new field to th search [...]

  3. Anonymous

    followed it step by step, get an error at the end:

    A reference to variable or parameter ‘mobile’ cannot be resolved. The variable or parameter my not be defined, or it may not be in scope.

    Any ideas?

  4. Anonymous

    Worked out the error message, the xsl is case sensitive.

  5. Matthew Dension

    Awesome this is exactly what I was looking for. Thank you!

  6. Chris

    OK – I want the get the HTML formatting applied to the “About Me” property – using the default method here all I get is text – any idea how I can get the HTML out?

  7. Selvan

    Hi Erwin,

    Very nice post. Would be nice if you could write someting to show fields in webpart from external database.

    Selvan

Leave a Comment

About

My name is Erwin Bastiaensen and I am a Software Architect from Belgium, with a huge interest in technology. Lately I have been involved in some Java projects and implementing, interfacing and extending a Sharepoint portal.

You can contact me at sharepointology[@]gmail.com.

View Erwin Bastiaensen's profile on LinkedIn