SharePoint Config

Ari Bakker's thoughts on customising and configuring SharePoint

How to: Create a Simple SharePoint 2010 People Directory

with 96 comments

I’ve had a few clients ask for a page on their intranet that allows users to browse a list of people within the organisation without having to enter a search query. They then want to see a list of filters such as Department or Job Title to allow them to filter the results. This is really easy to set up using the default SharePoint 2010 search web parts and doesn’t require writing a single line of code. An example of what this can look like is shown below (note no query is specified, we have just clicked on the ‘people directory’ link in the top nav):

sharepoint-2010-people-directory

Especially when the organisation only contains a few hundred people this can help users discover people in the organisation without necessarily knowing their names. The steps to create this are as follow (assuming the user profile and search services are running successfully):

  1. Assuming you have an enterprise search center set up the first step to create the people directory is to create a new page. This can be done by navigating to the pages library and selecting New Document > Page from the ribbon.

    create-search-page
  2. On the create page screen select the People search results page layout to create a page that contains the people search results web parts.create-page
  3. The standard search result web part does not show any results unless a query is specified. To get all people to show up by default we need to specify either a fixed keyword query or append text to the query in the People Search Core Results web part properties. If we specify a fixed keyword query the web part will always display results for the specified search query on the page regardless of whether the user has entered a search query. If we select append text to query then when the user types a query we will see results from a search query that includes both the text the user entered and the text in the web part properties. For our people directory we can use this to show a default set of results (i.e. all people) but let the user refine this further by entering text (e.g. a person’s name or a department). The query we need to enter to retrieve all people is contentclass:spspeople.
    keyword-query
  4. We now have a list of people that will be displayed as soon as the user navigates to our custom people results page. By default we also have some refinements that appear if matching metadata is found within the result set. These are View matches by Name or Profile, Job Title, Organization and Managed Metadata columns (these pull out information such as Past projects, Ask Me About and other Managed Metadata fields contained in the edit profile screen). We can change these to show other metadata properties that are defined in our search centre. Some other properties that might be relevant are Department, Job Title and/or Past Projects.
  5. [Update 10 June 2011] Note that the default Department managed property does not work correctly when used in the refinement panel (no results are displayed). To get this to work we need to create a new managed property that maps to the People:Department crawled property. This involves navigating to the ‘Metadata properties’ page of your search service application and creating a new Managed property. In this example I’ve named it DepartmentRefinement and mapped it to the People:Department(Text) property as shown below.
  6. To change these we can edit the ‘Filter Category Definition’ property of the refinement panel to include the XML shown below. [Updated 10 June 2011 to correct department refinement]
    <?xml version="1.0" encoding="utf-8"?>
    <FilterCategories>
      <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="Department"
     Description="Use this filter to restrict results to a specific department"
     Type="Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator"
     MetadataThreshold="5"
     NumberOfFiltersToDisplay="4"
         MaxNumberOfFilters="20"
         SortBy="Frequency"
         SortByForMoreFilters="Name"
         SortDirection="Descending"
         SortDirectionForMoreFilters="Ascending"
         ShowMoreLink="True"
        MappedProperty="DepartmentRefinement"
        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="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>
  7. The important things to note here is that we are adding a new Category element with Title=Department (this will be used as the category heading) and MappedProperty=DepartmentRefinement. The MappedProperty attribute needs to match a managed property in the search service application. Department is added as a managed property by default but if you want to include other properties such as Office you will need to make sure there is a managed property that contains this information.
  8. To ensure our custom Filter Category Definition is used we also need to ensure the Use Default Configuration is unchecked. Optionally we can also change the Accuracy Index to tweak the number of results that are inspected to generate refinements (higher values incurring a greater performance penalty but making refinements more accurate). For more details see the article “Change what appears in the Refinement Panel Web Part” on TechNet.people-refinement-panel
  9. Once this is in place we get an updated refinement panel and we now have a simple people directory page that people can use to discover individuals within the organization without having to enter a search query.sharepoint-2010-people-directory

This isn’t the most sophisticated people directory but it can be achieved in a few minutes without writing any code. With a little more effort we could change the rendering of the results (so they are displayed in a table layout for example) or provide additional filtering options such as an A-Z filter on the name field. If anyone is interested or has made other interesting additions to this search driven people directory please let me know in the comments below.

Post to Twitter Post to Delicious Post to Digg Post to Reddit Post to StumbleUpon

Written by Ari Bakker

May 16th, 2011 at 2:00 pm

Posted in 2010

Tagged with , ,

96 Responses to 'How to: Create a Simple SharePoint 2010 People Directory'

Subscribe to comments with RSS or TrackBack to 'How to: Create a Simple SharePoint 2010 People Directory'.

  1. Hi there,

    Have you found a way yet to sort this by last name?

    -Trey

    Trey

    15 Jun 12 at 5:51 pm

  2. Hi Ari,

    Does the enterpirse Search centre need to be set up as a Site Collection root?

    Cheers

    Hayden

    Hayden

    20 Jun 12 at 3:34 am

  3. I tried this but I don’t get all of the users.
    I only see +/-5 users and these are admin accounts farmaccounts, and site owners but no AD users

    this is the line I used contentclass = urn:content-class:SPSPeople and if I check the number of userprofiles than is shows that there are 95 user profiles in SharePoint 2010.
    and when I go to the enterprise search page than I can find all of my users but when I use this line “contentclass = urn:content-class:SPSPeople” I only the internal SharePoint users

    what im I doing wrong???

    Robert Huijser

    25 Jun 12 at 9:32 am

  4. Never mind, i found it, in the settings of the webpart there is a option where you can set the numbers of items showing that was on 6, this is now set on 50 and there are now 50 users in the list

    now i just need a way to filter the admin users and a way to see a second page.

    Robert Huijser

    25 Jun 12 at 9:54 am

  5. I found that you can filter some keywords, so i filterd te keywords of the service accounts.

    only 1 problem left. i get 50 users on a page but i have 75 users so i need a second page.
    i found the tick to create the second page but i get a http 404 error the webpage cannot be found

    so ?????

    Robert Huijser

    25 Jun 12 at 12:21 pm

  6. I set up the people directory and it works fine, but I have 70 users so I set it up to use a second page
    the link of the first page is http://sharepoint/SitePages/Smoelenboek.aspx
    but when I go to the second page it becomes http://sharepoint/SitePages/peopleresults.aspx?k=contentclass:spspeople WORDS(@ict) NOT WORDS(delivery, resourcemanagement,symantec,evenementen,KB,test )
    and I get a 404 error that the page can’t be found

    when I do this http://sharepoint/SitePages/Smoelenboek.aspx?k=contentclass:spspeople WORDS(@ict) NOT WORDS(delivery, resourcemanagement,symantec,evenementen,KB,test )
    I only get the first 50 not the rest.

    dues any one have suggestion ?

    Robert

    28 Jun 12 at 11:30 am

  7. @Hayden no the search centre does not need to be a site collection root site, this can be a sub site but you will need to ensure that the ‘Search Server Web Parts’ and ‘SharePoint Server Publishing Infrastructure’ features are activated on the site collection you create the search site in.

    Ari Bakker

    28 Jun 12 at 12:16 pm

  8. @Robert can you just use the search paging web part to allow users to see the second page of results on a single webpage?

    Ari Bakker

    28 Jun 12 at 12:26 pm

  9. The first page is now the people directory and the second page is the people search page, it is not as nice as i liked, but for now it is good enough
    my last problem is, in spspeople are users that are removed form AD
    in ad sync i don’t see them, in the user profiles there are not there, but in spspeople i still see them

    Robert

    30 Jun 12 at 9:20 am

  10. Is it possible to use this to show a directory of users from one office location, rather than all employees? I have mapped properties from the AD Sync, but just don’t know how to use them to filter the results.

    Cori

    10 Oct 12 at 6:32 pm

  11. @Cori you can show a directory of users from a specific office location by 1) creating a managed property e.g. OfficeName that maps to the People:Office crawled property (see step 5 for details on creating a managed property) then running a full crawl and 2) updating the ‘append text to query’ property mentioned in step 3 to include the officename filter e.g. ‘contentclass:spspeople officename:westminster’.

    Ari Bakker

    10 Oct 12 at 10:16 pm

  12. Ari, i have a problem with my sharepoint 2010 list view filter,like you did my post above on people directory,I want to know,how do you implement when you want to display all the document without the filter.My problem is,if you were the contributor for the document you can view/edit your document only,but if you were admin/controller for the site you can view all the document that your contributor add,How I can find this type of solution?with screenshot if necessary you want to show it to me. Thanks Ari

    Loque

    27 Nov 12 at 7:45 am

  13. Hi,

    Have one problem.

    When I go to page with default view I have good results of people in the commpany.

    But when I try to search by name then my results are double.

    Did someone know why?

    Dejan

    16 Jan 13 at 12:08 pm

  14. @Dejan when you put the page in edit mode do you see two search results web parts or only one?

    Ari Bakker

    17 Jan 13 at 10:15 pm

  15. Yes I have.

    Also in mode for settings for web part i option “More results for the query”, I have marked the option “remove duplicate results”.

    Tnx for replay

    Dejan

    18 Jan 13 at 1:45 pm

  16. Please :)….

    Anyone 😛

    Dejan

    23 Jan 13 at 8:33 am

  17. @Dejan if you have two Search Core Results web parts on the page set to show search results (under the miscellaneous category) in the properties then one probably needs to be removed. If you have duplicate results inside the same Search Core Results web part then it could be a problem with the search index – if you are able to it might be worth resetting the search index and performing a full crawl but note this will remove all search results from the site while the crawl is in progress.

    Ari Bakker

    24 Jan 13 at 9:38 am

  18. Tnx for replay.

    I have only one web part so I will try to reset search index and then performing a full crawl.

    After that, I’ll let you results.

    Dejan

    31 Jan 13 at 8:59 am

  19. […] had several requests to show how to implement sorting following my previous posts on creating a simple SharePoint 2010 people directory and using a table based layout for a SharePoint 2010 people directory. This post shows how to […]

  20. @SKDonahue, @Thomas Resing, @Taenkeren, @Nicole, @Trey I finally posted on how to sort this by last name at SharePoint 2010 People Directory Part 3 – Sorting

    Ari Bakker

    5 Feb 13 at 10:04 pm

  21. This is just what I was looking for, thanks for this info.

    I cannot get Job Title to display in my People Refinement Panel. I am using SharePoint Online synced to my local AD.

    The AD attribute I want on the refinement panel is “title”. I see this shows up under a person’s name in People Search Core Results web part (column name “JobTitle”), but it does not display as a refinement option.

    Any tips? Thanks!

    Mitch

    7 Feb 13 at 6:02 pm

  22. @Mitch I don’t have SharePoint Online synced to AD but when I add users to SharePoint Online with the Job Title field populated the Job Title refinement shows up. There is a threshold for each refinement which I believe is 3 by default so if there are less than 3 users with the job title populated it will not show up. Could this be the issue?

    Ari Bakker

    8 Feb 13 at 9:03 am

  23. Thanks for the reply.
    I did notice the threshold when I started testing and I set it to 1 for each category.
    I went back to AD and changed the Job Title for a couple test users to be the same title (to be make sure I was over the threshold). I see that this change in AD has updated correctly on the SharePoint Online user management page – so I don’t think the issue is with ADFS.
    Anyway, aside from the job title glitch, the staff directory still works and looks fantastic …so thanks again!

    Mitch

    11 Feb 13 at 9:02 pm

  24. Hi, Great post it works well. Do you by any chance know if people search web part and results web part can be placed on the same page? Mine seems to go to the search center results when I try to perform any search. I was hopping to return the people search results under the people search web part on the same page.

    Best Regards
    Simona

    Simona

    22 Feb 13 at 8:10 am

  25. @Simona if you are referring to the people search box web part then you need to change the ‘Target search results page URL’ property of the web part (in the miscellaneous section) to point to the page you want to use to display results when a search term is entered. If you set this to the name of your page users should see the results updated on the same page.

    Ari Bakker

    22 Feb 13 at 10:03 am

  26. Can this be done withing Sharepoint Services 2.0? Thanks.

    Mary Brown

    8 Apr 13 at 4:21 pm

  27. @Mary I haven’t tried with WSS 2.0 but my guess would be that this would not work without significant changes

    Ari Bakker

    10 Apr 13 at 10:50 am

  28. Thanks! It was wishful thinking. Bummer.
    Thanks for replying!

    Mary Brown

    15 Apr 13 at 7:33 pm

  29. […] previously posted on how to create a simple people directory for SharePoint 2010. The process is slightly different in SharePoint 2013 due to the substantial changes in the search […]

  30. I have a problem with job titles refinement.
    I have tens of people in my directory. If I list all the names I have defined that only 20 results are shown at one page. That works fine except that the refinement panel displays only the job titles that are at the first page of the results. Foe example, a job title that is displayed on page two cannot be seen until you go to page two of results.
    How to make refinement panel show all the job titles of the results?

    HiluLe

    28 Jul 13 at 9:32 am

  31. @HiluLe the accuracy index property on the refinement web part can be used to change how many results are inspected for generating refinement values. I would try increasing this to a higher value.

    Ari Bakker

    28 Jul 13 at 10:20 am

  32. Thanks Ari for your reply! The solution seemed to be too simple. 😉

    HiluLe

    28 Jul 13 at 12:25 pm

  33. I followed the directions in this blog and everything is setup and looks good. I do have one small issue and hoping to get some hints on a fix. if i open the employee directory (as i call it) to the default page i get all users in alphabetical order. as i have 4000 users i have lots of pages. heres the issue….. the person listed last on the page will show up on the next page as well. sometimes he/she is the first person on the next page, sometimes he/she is a few users down on the next page and everyone above is also from the previous page as well.

    did i explain that well enough?? i sure hope so. i hope someone that understands it also has a fix.

    Mike

    6 Aug 13 at 1:59 pm

  34. Hi-
    Can I set up the enterprise search center for an existing site? because I am unable to find the People search results Layout.

    Thanks in advance!

    Santosh

    20 Aug 13 at 2:56 pm

  35. Hi Ari,

    Is it possible I replicate this on SharePoint 2010 Foundation knowing that it it does not have user profile.

    Regards,

    Bisi.

    Bisi

    12 Sep 13 at 12:53 pm

  36. @Bisi this article is only applicable to the standard or enterprise versions of SharePoint 2010. SharePoint Foundation 2010 does not have the refinement panel or people search capabilities required to make this work.

    Ari Bakker

    12 Sep 13 at 1:51 pm

  37. Ari. Is it possible for you to provide tabular view html code with a user profile picture insert. Ive created a Item Person_table display template. However I cant seem to get the picture to display inside the table and consecutively aside each user contact information. Ive seen this post quite a bit but no answer for it as of yet.

    PW

    7 Feb 14 at 4:21 pm

  38. Ari–great article. Having a little trouble with one thing. I want to drop the search widget, and results widget on my portal home page, and have the search results just load up, but *not* take me to the /sitespages/search.aspx page or whatever. Can I do that? Anyone know how? I’ve changed the search results page to home.aspx but it doesn’t work.

    Ben

    21 Feb 14 at 9:26 pm

  39. I am having the same issue that some of you have had with each record showing twice. Even in edit mode. I have tried out other staff directory web parts and they don’t show records twice so I don’t know what I am doing wrong. I also have the Remove duplciates checkbox checked. Can someone help me out? Thanks!

    Kathy

    6 May 14 at 8:17 pm

  40. I am new to SharePoint 2010, so I have many questions. I’ve been given a task to implement People Directory solution, so I’ve decided to follow your tutorial. The thing is that, the search web part is not working, so I guess there is much more work than it looks like in this tutorial. I guess, I must start the User Profile Service and the User Profile Synchronization Service, as well as create User Profile Service Application and probably Search Service Application(?) The problem is that, there is already another solution running on the SharePoint server, so there is existing User Profile Service Application. I’ve been wondering if I can use the existing User Profile Service Application, or if it’s better to create a new one(?) What is more, I’ve been told that the existing solution is already connected to the Active Directory, but in the Central Administration I see that the User Profile Synchronization Service is not started which is confusing. Am I gonna make a mess if I create a new User Profile Service Application and connect it to the User Profile Synchronization Service? And what is the thing with the Search Service Application? Is it mandatory for making the People Directory work? What if one (Search Service Application) already exists? I hope that someone can explain me. Thanks in advance!

    Maria

    30 Jun 14 at 11:02 pm

  41. Hey Mate,
    Thanks for wonderful example but is it possible to filter users based on the SharePoint group?
    or do you know any way to display user profile based on SharePoint group?
    Thanks in advance.

    Aniket

    20 Aug 14 at 6:52 am

  42. @Aniket if you navigate to Site Settings > People and Groups and select a SharePoint group you get a list of all people in the group with a link to their user profile. Is that what you are after?

    Ari Bakker

    20 Aug 14 at 4:22 pm

  43. @Ari thanks for your reply. Actually, I want to display list of staff members on my departments home page so I was trying to filter people search core results web part based on SharePoint group or department field. I have already achieved that by using contentclass:spspeople Department:”Sales” query.

    Aniket

    21 Aug 14 at 1:07 am

  44. Hi,
    I failed in the first step :(
    I changed the web part properties of People Core Search web part to contenttype:spspeople however it does not bring any people but just say: No people results matching your search were found.
    Any idea what could be going wrong? Search crawler works fine and I can get other searches working fine but this just does not work :(

    Ova

    22 Dec 14 at 10:43 am

  45. @Ova the query needs to be contentclass:spspeople

    Ari Bakker

    29 Dec 14 at 5:01 pm

  46. […] How to: Create a Simple SharePoint 2010 People Directory … – This article shows how you can create a simple SharePoint 2010 people directory without writing any code…. […]

Leave a Reply

*