Category Archives: PeopleSearch

SharePoint: Modifying the PeopleResults.aspx – adding custom Profile Properties

To modify the results of the peopleresults.aspx, a few stepts have to be taken.
In my case, a Division is added to the results.

at first, make sure that the property that you want to display, is indexed so it will be part of the People Search Scope: Go http://MOSS2007/ssp/admin/_layouts/MgrProperty.aspx and select or add the UserProfileProperty that you want to be part of the search result. Check the indexed box.

Open your own userprofile, and add some data in the field.

After this, start a new full crawl on the contentsource that has the sps:// (people search) tag in it. When its finished, you will find the Division back in your metadata properties:

Now you will be ready to modify your peopleresults.aspx:
Go to this page, and open the page in edit mode. FInd the searchresults box, and open this one in edit mode, too. Press the “XSL-editor” button in here.
in here, you can edit the xsl to add the custom userprofile properties to the results.
I am gonna add this to the office information (I know it doesnt belong there, but hey, its just an example):

find the psrch-Description, and add an xsl:with-param names divi, which selects the division userprofile property from the peoplesearch results.

<div class="psrch-Description">
                        <xsl:call-template name="DisplayOfficeProfile">
                            <xsl:with-param name="title" select="jobtitle" />
                            <xsl:with-param name="dep" select="department" />
                            <xsl:with-param name="phone" select="workphone" />
                            <xsl:with-param name="office" select="officenumber" />
                            <xsl:with-param name="divi" select="division" />
                        </xsl:call-template>
</div>

now, find the DisplayOfficeProfile section and add a xsl-param name and a check + value of that parameter to display it in the results:

<xsl:template name="DisplayOfficeProfile">
        <xsl:param name="title" />
        <xsl:param name="dep" />
        <xsl:param name="phone" />
        <xsl:param name="office" />
        <xsl:param name="divi" />
        <span class="psrch-Metadata">
            <xsl:if test='string-length($title) &gt; 0'>
                <xsl:value-of select="$title" />
                -
            </xsl:if>
            <xsl:if test='string-length($dep) &gt; 0'>
                <xsl:value-of select="$dep" />
                -
            </xsl:if>
            <xsl:if test='string-length($phone) &gt; 0'>
                <xsl:value-of select="$phone" />
                -
            </xsl:if>
            <xsl:if test='string-length($office) &gt; 0'>
                <xsl:value-of select="$office" />
                -
            </xsl:if>
            <xsl:if test='string-length($divi) &gt; 0'>
                <xsl:value-of select="$divi" />
            </xsl:if>
        </span>
        <br/>
    </xsl:template>

Save the template and press apply. Prepare for an error, but don’t worry: publish the page and reload it, and your peopleresults will be updated with the custom property

Customizing MOSS Search – Part 1

MOSS 2007 and WSS 3.0 are using the same search engine. It only differs in the options that are available to each of the products. As expected, MOSS 2007 has a lot more functionality then WSS 3.0. Where WSS 3.0 is only able to use contextual search (as in: this site, this list), MOSS 2007 can be configurated to search in the whole farm (content sources), to search for certain type of results (defined in scopes), scheduling the crawl and property management (search on metadata).

Content Sources are the sources where we can get the information from. As per default, just 1 content source is defined: Local Office SharePoint Server sites. Within this Content source, all newly sitecollections are added to be crawled. It is also possible to add other sources like exchange folders, file shares and other websites. Those items are crawled using the default access account. If that account has no access to a source, those items are not crawled, and vice versa. When this account has a to high permission level on those sources, it can be possible that information that is not intended to be searched, is shown into the search results. This is not the case for sharepoint sites that are searched, because the results for these sites are security trimmed.

Search Scopes defines the kind of data you are searching for within a certain area. Two default scopes are “All Sites” and “People”.  The first scope defines that all information within All available sites is searched. The “People” scope is used for the people search. The data that is found within this scope are just user profiles. A third scope can be added, for example “News” In this scope you can specify that all content sources have to be used, but you require that only data with contentType NewsItem is included. This last requirement is called a “Property Query”

Managed Properties are properties that can be used in scopes. Those properties are provisioned by crawled properties that are mapped to this managed properties. For example, after a full crawl, there some new crawled properties are found: ows_AssignedTo(Text) and ows_Assigned_x0020_To(Text). Those two crawled properties can be mapped to the managed property AssignedTo. From now, in a Search Scope with the property Query “AssignedTo = Bas Lijten” can be used to create a scope where all items that are assigned to “Bas Lijten” can be searched. All items that apply to this rule, have a metadata property (crawled property) ows_AssignedTo or ows_Assigned_x0020_To with the value Bas Lijten

Configuring People Search

Configuring the People Search isn’t that hard. At first, you will need of course, user profiles and their user profile properties. You will have to configure the user import for this. After this, decide what user profile properties need to be indexed. With this index,  the user profile property will be part of the People Search Scope Schema. If a property is indexed, you will be able to search for that element, and you will be able to add that propety as a search result. When those configuration settings are made, the userProfile store needs to be crawled. If i am right, this is not enabled by default. This can be enabled by adding the following entry to one of the content sources:
sps3://mysite-host/

When this entry is added and a full crawl is started, all userProfiles will be added, together with its properties that can be used in a scope now.

In the next parts I will explain how to configure the search centre, how to configure/style the main search box and how to style the peoplesearch page.