Modifying People Search Results

By Michael Doyle posted 10-08-2010 01:10

  

If you want to change how the people search result look, you are going to have to delve into the world of XSL. The first step is to create an XSL file on your SharePoint site. I would recommend putting it in the Site Assets directory. To get started just open up notepad and create a file called peoplesearch.xsl and upload it to the Site Assets directory. Now you can go to your people search results page and open it in advanced mode. You will need to detach it from the page layout before you do this. Once you have opened this up in SharePoint designer, copy the XSL from the People Core Search Results. Copy everything from

<xsl:stylesheet to </xsl>

This is about 600 lines of XSL, but don’t be daunted. Copy this code into your file in the Sites Assets directory and save it. Next modify edit the people results page People Core Results web part in the browser and expand the Miscellaneous group and put in the url path to your peoplesearch.xsl in the  XSL Link field. Now you can edit the peoplesearch.xsl field and it will modify the XSL for the People Core Search Results. If you had tried to do it within the page itself it would change itself back.

Example:

If you wanted to remove the Add to my colleagues link you would remove

  <xsl:if test="$hasacu">

          <li id="AddColleagueLinkField">

            <a id="{concat($currentId, '_AddColleagueLink')}" href="{ddwrt:EnsureAllowedProtocol(string(addtomycolleaguesurl))}">&#187; <xsl:value-of select="$AddToMyColleaguesText" /></a>

          </li>

        </xsl:if>

from peoplesearch.xsl. Also, if you want to put in any styling or word changes you can do it in this section. The point here is that you look up the html that is pushed out and that is where you can change the output. Make sure you put versioning on Site Actions or you back up your XSL because it is obviously easy to mess something up.

Good luck with your modifications!



#People #sharepoint #SharePoint #XSL #Search
0 comments
108 views