Add “Click to Call” to SharePoint People Search

At Catapult we recently implemented Unified Communications all the way to our phones. I love the functionality and reach provided by the UC solution. I love getting voice mail in my Inbox. I have to be more careful about my Communicator Status, but that is easy. We needed an easy way to enable calling and lookup inside the company. We already had People search so I decided to add the ability to click the displayed phone number to call the found person. It just requires adding a hyperlink with the TEL: prefix.

There are two web parts that display the people results, “Search High Confidence Results” and “People Search Core Results”. Both need to be edited but the changes are the same.

People Search Results with phone number

  1. Begin by placing the page in edit mode. Site Actions | Edit Page.

  2. Once in edit mode choose the Edit menu on the People Search Core Results web part and choose Edit Shared Web Part.

  3. Click the XSL Editor button and copy the contents of the dialog into a new file in the site collections** XSL Style Library**. [I describe this technique in detail in my post about image search.]/blog/archive/2008/09/01/sharepoint-image-search-part-4/)

  4. Create a link to your new file and test that everything is wired up correctly. Note: if you get the following error you should not panic. This is a known defect in the PSC Web Part and I don’t expect it to be fixed any time soon as I pointed it out years ago. It usually resolves on it’s own after you publish the page.

      System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Microsoft.Office.Server.Search.WebControls.PeopleCoreResultsWebPart.SetSortedRefinementDataOnHiddenObject() at Microsoft.Office.Server.Search.WebControls.PeopleCoreResultsWebPart.SortResultsIntoArrayLists(XmlNodeList resultsList, Hashtable colleagues, Hashtable colleaguesWCollOfColl, UserProfile currentUserProfile) at Microsoft.Office.Server.Search.WebControls.PeopleCoreResultsWebPart.SortBySocialDistance() at...

  5. Near the end of the style sheet locate the lines:

      <xsl:if test='string-length($phone) < 0'>
         <xsl:value-of select="$phone" />

  6. Change the second line to:

      <a href="tel:{$phone}" title="Call {preferredname}" >
        <xsl:value-of select="$phone" />

(I know it’s bad form to use preferred name, and you should know better, in production add preferred name to the DisplayOfficeProfile template as a parameter and pass in preferred name. I took a short cut so I did not have to spend hours writing this post!)

  1. Save your changes and check in your page your results should look like this Clickable phone numbers
|| My Sites || Search || Social Networking

comments powered by Disqus

Let's Get In Touch!

Ready to start your next project with us? That’s great! Give us a call or send us an email and we will get back to you as soon as possible!