Put People First – Building a Staff Directory

This is a follow up of my previous post – Understanding SharePoint Sites

When customers ask me what they should be doing with their newly deployed SharePoint environment, I say Put People First! – Let users find their peers, colleagues. Let them share information with their peers/colleagues. Redirecting your users to search page doesn’t count. It is just a blank white page! You should see how you can show the available options to users so they get interested with the content and come back often to search for people. Sometimes, small change can drive user adoption!

Building a simple Staff Directory

Customising the Refinement Panel

Customising the Search Options Popup

Building a simple Staff Directory

Building a Staff Directory, listing all users and allowing to filter according to metadata properties such as department, office would be a good start.

To do so, create your search center (as a separate site collection or sub site).

Once created, click on Site Actions | View All Site Content

Click on Pages library under Document Library

Create a new Page

image

Enter Staff Directory for Title and select People search results as the page layout and click Create to create the page

image

Click on Staff Directory page to open the page and click on Site Actions | Edit Page to edit the page

Edit the People Search Core Results web part

In the web part properties, expand Results Query Options

Enter the following in the Append Text To Query:

 contentclass:spspeople

In the web part properties, Click Ok

Edit the People Search Box web part

In the web part properties, expand Miscellaneous

Change the Target search results page url to your staff directory page. In my case it was: Staff-Directory.aspx

Click Ok

Save the page

You should now see the page displaying people results automatically and also the refinement panel filled with metadata values

image

You can use the refinement panel to filter your results

image

Search Site Clean-up

Now that we have our Staff Directory page working, we can clean up few things like:

  • Removing the search tabs

    • Go to Site Actions | View All Site Content
    • Delete all the items in the the following lists:
      • Tabs in Search Pages
      • Tabs in Search Results
  • Make Staff Directory page home page

    • Navigate to the staff directory page
    • In the Ribbon, click on Page tab and then click on Make Homepage

Customising the Refinement Panel

We would now like to customise the refinement panel where we would like to show and allow users to filter by, say, Department.

In order to add the department metadata in the refinement panel, we need to create a new Managed Property under Search Administration

NOTE: The out of the box Department managed property does not work well with refinement panel. This is a known issue.

Open Central Administration and navigate to your Search Service Application

In the Search Administration, click on Managed Properties in the left hand navigation

Click on New Managed Property

Enter the following:

image

Choose Text for the type of information

Click on Add Mapping

Search for department and then choose People: Department(Text) from the results and click Ok

image

Optionally you can select this property to be used in scopes

Perform a full crawl on the people content source

Navigate to the staff directory page and click on Site Actions | Edit Page

Edit the People Refinement Panel web part

In the web part properties, expand Refinement

The Filter Category Definition is responsible for showing the filters in the refinement panel. We need to edit this and add our department metadata. Below is the XML text for the department metadata:

<Category Title="Department"

Description="Use this filter to restrict results to a specific department"

Type="Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator"

MetadataThreshold="5"

NumberOfFiltersToDisplay="4"

MaxNumberOfFilters="50"

SortBy="Frequency"

SortDirection="Descending"

SortByForMoreFilters="Name"

SortDirectionForMoreFilters="Ascending"

ShowMoreLink="True"

MappedProperty="DepartmentNames"
MoreLinkText="show more"

LessLinkText="show fewer"/>

Notice the highlighted property which defines our managed property we created earlier. Make sure the value matches the managed property name.

Below is the full XML:

<?xml version="1.0" encoding="utf-8"?><FilterCategories>
<Category Title="View" Description="View matches by" Type="Microsoft.Office.Server.Search.WebControls.RankingModelFilterGenerator" MetadataThreshold="3" NumberOfFiltersToDisplay="3" ShowMoreLink="False" MappedProperty=""/>
<Category Title="spshjobtitle" Description="Use this filter to restrict results to a specific job title" Type="Microsoft.Office.Server.Search.WebControls.TaxonomyFilterGenerator" MetadataThreshold="3" NumberOfFiltersToDisplay="3" MaxNumberOfFilters="50" ShowMoreLink="True" MappedProperty="ows_MetadataFacetInfo" MoreLinkText="show more" LessLinkText="show fewer"/>
<Category Title="Organization" Description="Use this filter to restrict results to a specific organization" Type="Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator" MetadataThreshold="5" NumberOfFiltersToDisplay="4" MaxNumberOfFilters="50" SortBy="Frequency" SortDirection="Descending" SortByForMoreFilters="Name" SortDirectionForMoreFilters="Ascending" ShowMoreLink="True" MappedProperty="OrgNames" MoreLinkText="show more" LessLinkText="show fewer"/>
<Category Title="Department" Description="Use this filter to restrict results to a specific department" Type="Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator" MetadataThreshold="5" NumberOfFiltersToDisplay="4" MaxNumberOfFilters="50" SortBy="Frequency" SortDirection="Descending" SortByForMoreFilters="Name" SortDirectionForMoreFilters="Ascending" ShowMoreLink="True" MappedProperty="DepartmentNames" MoreLinkText="show more" LessLinkText="show fewer"/>
<Category Title="Managed Metadata Columns" Description="Managed metadata of the documents" Type="Microsoft.Office.Server.Search.WebControls.TaxonomyFilterGenerator" MetadataThreshold="3" NumberOfFiltersToDisplay="3" MaxNumberOfFilters="50" ShowMoreLink="True" MappedProperty="ows_MetadataFacetInfo" MoreLinkText="show more" LessLinkText="show fewer"/>

</FilterCategories>

Uncheck the Use Default Configuration

image

In the web part properties, click Ok and Save the page

We should now see Department in the refinement panel

image

 

If you want to add any other property to the refinement pane, make sure you have a managed property associated with it.

Customising the Search Options Popup

Search options is a popup that comes up with when you click the 'Search Options’ link

image

You can customise this popup to include your option, say Department so we could search by department

Navigate to staff directory page and click Site Actions | Edit

Edit the People Search Box web part

In the web part properties, expand Miscellaneous

The Properties XML defines what appears in the popup. Below is the XML to add Department property:

<Property Name="Department" ManagedName="Department" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:Department"/>

Make sure the highlighted values are same as the managed property in the search administration. The text in bold should match the user profile property.

Below is the full XML which you can replace for the Properties XML

<Properties>

<Property Name="LastName" ManagedName="LastName" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:LastName"/>

<Property Name="FirstName" ManagedName="FirstName" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:FirstName"/>

<Property Name="JobTitle" ManagedName="JobTitle" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-JobTitle"/>

<Property Name="Department" ManagedName="Department" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:Department"/>

<Property Name="PersonKeywords" ManagedName="PersonKeywords" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-PersonKeywords">

<EffectiveProperty Name="Responsibility" ManagedName="Responsibility" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-Responsibility"/>

<EffectiveProperty Name="Skills" ManagedName="Skills" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-Skills"/>

<EffectiveProperty Name="Interests" ManagedName="Interests" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-Interests"/>

</Property>

</Properties>

In the web part properties, click Ok

Save the page

Click on Search Options and you should see the Department option in the popup

image