30 Mai 2008

Display Profile Properties in Table Style

I would like to show you, how you can display profile properties in a table. For example this would allow you to generate a telephone directory from your profile data.

Briefly this would be done in two steps: indexing your profile properties and displaying them with a People Results Web Part.

Let's start creating a managed property. Every property you would like to display on the list, must be crawled by the index and mapped to a managed property.

Creating a managed property
  1. On the SSP admin site, go to the "User profile and property" page, select "View Profile Properties" and select the profile property, you want to display. You could also create new properties.
  2. Make sure that the checkbox "Indexed" is selected.
  3. Repeat this set for every property.
  4. Do a full crawl of the SSP/MySite content source (usually the "Local Office SharePoint Server sites")... and wait until it is completed.
  5. Now you can create managed properties. For this, go to "Search Settings" and choose "Metadata property mappings".
  6. First check, if your desired property is no all ready managed. If not, create a new managed property and add a mapping to the crawled property.
  7. Again start a full crawl.

Sample with the managed property "Xing" which is mapped to the crawled propery "Xing".

Bringing the properties to the screen

Of course you could write a Web Part which iterates over the profiles and then render the data in a gridview. But you can also do this by configuration with the People Search Core Results Web Part.
  1. To begin, you have to create a new Web Part Page and add the "People Search Core Result s".
  2. In the Web Part Properties you set a "Fixed Keyword Query" and select a Cross-Web Part Query ID different from "user query". As "Fixed Keyword Query" you could enter contentclass:"SPSPeople" to display all profiles. But you can also define a custom query, which matches only to a parts of the profiles in your Shared Service Provider.

  3. Under "Selected Columns" add a line for every Managed Property. Check first, if it's not allready there. In our sample, I added <column name="Skills"> before the closing </columns> tag.
  4. Now we have to edit the XSL. If you are a native XSL speaker like my fellow worker Dänu, you can start creating your XSL and can stop reading here.

  5. If not, here some tricks how this could be done. I would suggest, that you copy the existing XSL. This XSL could be used later as a starting point.
  6. With the following XSL you can output the XML code of the search resutls.

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="@* | node()">
    <xsl:apply-templates select="@*|node()" />

    Copy & Paste it in to the XSL editor field and hit "Apply".
  7. Now you have to look at the HTML source code. Search for and copy the hole tag (until the closing ) to the clipboard. In this XML you will see all the properties returned by SharePoint.
  8. If you are familiar with Visual Studio 2008 you could use it to generate a new XSL. Save the XML output to a file und try to run the XSL against that file (Menu: XML \ Show XSLT Output).

Here is a sample XSL which display the name, the e-mail and a like to a Xing profile.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<!-- XSL transformation starts here -->
<xsl:template match="/">
<xsl:apply-templates />

<!-- This template is called for each result -->
<xsl:template match="All_Results/Result">
<xsl:variable name="id" select="id"/>
<xsl:variable name="url" select="url"/>
<a href="{$url}" id="{concat('CSR_',$id)}">
<xsl:value-of select="preferredname"/>
<xsl:value-of select="workemail"/>
<xsl:if test='string-length(xing) &gt; 0'>
<a href="{xing}" id="{concat('XING_',$id)}">
<xsl:value-of select="xing"/>

4 Kommentare:

Ulrich Bernskov hat gesagt…

Only problem is that you cannot display more than 50 hits per page, which makes the list for contentclass:"SPSPeople" less useful

Anonym hat gesagt…

I am trying to figure out a way to use this same idea but I need the query to be dynamic. Basically I want to lookup who is logged on to the current page, do a lookup in a list, and then feed the values returned back to the core results webpart. However, I have not found a way to provide/consume data values to this webpart. I also don't see a way to setup a dynamic query each time the page loads instead of a fixed query. Anyhelp would be appreciated.

Anonym hat gesagt…

Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!

ncth hat gesagt…

Hi David,

I've checked your post. It's useful for me to pull the user profiles from SSP. But I only want to get the users from a specific AD group defined in new connection at SSP rather than all users imported to SSP. Is there anyway to import the users based on a connection from SSP? Thanks.