SharePoint Config

Ari Bakker's thoughts on customising and configuring SharePoint

How to: Create a Simple SharePoint 2013 People Directory

with 135 comments

I 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 functionality so the updated steps are shown in this post.

A people directory can be useful if you want to list all the people in an organisation without users having to enter a search query. Users can then narrow down the list using filters such as Department or Job Title to narrow the results. This is really easy to set up using the default SharePoint 2013 search web parts and doesn’t require writing a single line of code. An example of what this can look like is shown below:

sharepoint 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 enable the people search page layout so we can create a people search results page. This can be done by navigating to the Site Settings > Look and Feel | Page layouts and site templates page and selecting ‘(Welcome Page) Search People’ in the Page Layouts section.
    sharepoint available page layouts search
  2. The next step is to navigate to the pages library and select New Document > Page from the ribbon.
    sharepoint new page
  3. On the create page screen select the Search People page layout to create a page that contains the people search results web parts.
    sharepoint create people results page
  4. 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 modify the query used by the People Search Core Results web part. This can be done by clicking the ‘Change Query’ button in the web part properties and adding a property filter that returns all people. To do this we can select the property ‘contentclass’ and enter the manual value ‘spspeople’.
    sharepoint search build query
  5. 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 the Department, Job Title, Keywords and Office Location columns. We can change these to show other metadata properties that are defined in our search centre by selecting the ‘Choose refiners’ option on the refinement web part. Note that the managed property must have the ‘Refinable’ option selected in the search schema for it to be available in this list.
    sharepoint search refinements

 

Adding Sorting by Last Name

Adding additional sort options is much easier than in SharePoint 2010. To add a custom sort option such as Last Name follow the steps below:

  1. Ensure that the managed property you want to sort by has the Sortable option enabled in the search schema. To do this navigate to the Search Service Application > Search Schema, click the LastName managed property and select the Sortable: ‘Yes – active’ option. Note you will need a full crawl for this to take effect.
    sharepoint 2013 managed property sortable
  2. On the search results page edit the People Search Core Results web part, check the ‘Show sort dropdown’ option and enter the following text:
    [{"name":"First name (A-Z)","sorts":[{"p":"FirstName","d":0}]},{"name":"First name (Z-A)","sorts":[{"p":"FirstName","d":1}]},{"name":"Last name (A-Z)","sorts":[{"p":"LastName","d":0}]},{"name":"Last name (Z-A)","sorts":[{"p":"LastName","d":1}]},{"name":"Social distance","sorts":[]}]sharepoint search sorting
  3. You should now be able to sort by first or last name in alphabetical order either A-Z or Z-A.
    sharepoint search people sorting

 

Using a Table Based Layout

Another option for the people directory is to use a table based layout with column headers for properties. In SharePoint 2013 this can be done using Display Templates. In this case we need to use two display templates – a control template for the table header, and a item template for each search result item. The steps to implement this are shown below.

  1. The first step is to add the display templates to the masterpage gallery by selecting Site Settings > Master Pages and Page Layouts > Display Templates > Search and upload the two html files from the following .zip archive.
    PeopleDirectoryDisplayTemplates.zip
  2. The next step is to edit the search core results web part and in the Display Template section set the Results Control Display Template to ‘Table Result’ and the Item Display Template to ‘People Table Item’.
    sharepoint search display template selection
  3. You should now see the results displayed as a table based layout as shown below:

sharepoint people directory table

If you have worked with previous versions of SharePoint you can see that in SharePoint 2013 the search features are much richer and easier to work with. There are also a number of new features such as query rules and extensibility options such as customising the hover panel that enhance the end user search experience.

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

Written by Ari Bakker

May 17th, 2013 at 11:00 am

Posted in 2013,Configuration

135 Responses to 'How to: Create a Simple SharePoint 2013 People Directory'

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

  1. Thanks Ari, so does this mean that i cant delete it directly from the created people directory site ??, how would u suggest i go about deleting users ?this is because if i delete a user from active directory ,the user profile is still present in the people directory.

    jay

    29 Jan 15 at 11:25 am

  2. […] (@aribakker) post that shows how to set up a simple a Employee Directory on SharePoint 2013: How to: Create a Simple SharePoint 2013 People Directory, he shows how to tweak the Lastname property to make it […]

  3. Thanks for this Ari.

    I have got this working however I have a few issues:

    1. When I click on the name I get “Sorry, something went wrong User not found.”

    2. Not all Departments are displayed on the left hand side navigation

    3. When I hover over a name the preview only shows Authored documents and below it displays View Profile and Follow – how can i add more options like you have above e.g Job Title, department, phone number, secretary

    Thanks in advance.

    Chad

    19 Feb 15 at 5:05 pm

  4. Sorry please ignore point no 2 I solved it.

    Chad

    19 Feb 15 at 5:17 pm

  5. I have a Office365. For some reason the “Office” column in the table is empty. How do I get Office to appear?

    Nicole

    26 Feb 15 at 6:40 pm

  6. spspeople does not produce a list

    diane

    3 Mar 15 at 5:20 pm

  7. Is this doable on DFoundation 2013? As we do not currently have the budget for licensing.

    John Nav

    18 Mar 15 at 11:48 pm

  8. Thanks Ari for the informative article. Well written. Quick Question – Is the table based layout is just a table display or the columns are sortable or filterable like any SharePoint list view?

    Regards,
    Khushi

    Khushi

    1 Apr 15 at 6:58 pm

  9. Thanks @Khushi – This does not use a SharePoint list view so the columns themselves are not filterable or sortable. You can, however, filter using the refiners and sort using the drop down as shown in the article.

    Ari Bakker

    2 Apr 15 at 2:51 pm

  10. @John Nav this will not work with SharePoint Foundation 2013 as the user profile functionality is not available.

    Ari Bakker

    2 Apr 15 at 2:51 pm

  11. I have got this working however I have a few issues:

    1. When I click on the name I get “Sorry, something went wrong User not found.”

    2. When I hover over a name the preview only shows Authored documents and below it displays View Profile and Follow – how can i add more options like you have above e.g Job Title, department, phone number, secretary

    Thanks in advance.

    Chad

    8 Apr 15 at 9:44 am

  12. […] have found an OOTB solution. I am following this […]

  13. Like Chad commented, even I cannot see more details like Job Title, department, Phone number etc. when I hover over the name. Could you please help us?

    Rookio

    10 Apr 15 at 4:28 pm

  14. Great posting but I am having the same problem as 3 other people here.

    If I use contentclass=spspeople I get no results.

    I am using the simplified version of the UserProfile service where it imports AD information. I have 500 user profiles.

    If I use the standard search without the suggested mods I do get results. What gives?

    Solvetech

    19 Apr 15 at 11:47 am

  15. Great information here on creating and employee directory in SharePoint. We have our directory setup and we are pulling the pictures from O356, but the sync process does not seem to work so if someone adds a new picture to O365 that picture will not show up in the employee directory unless the person browse to my.sharepoint.com/PersonImmersive.aspx link and even then is takes days. Any idea around this? The company does not want people uploading their own pictures for security reasons. So is there a way to pull the pictures from O365 easily.

    Madra

    30 Apr 15 at 4:19 pm

  16. Great and useful post. I am facing issue with the display of the Search box on the page. It is being displayed at the right side corner of the page. But i want it on the centre of the page similarly in the post above. Any help/suggestion greatly appreciated.

    Pk

    11 May 15 at 11:31 am

  17. Great post! Thank you, Ari!
    I am facing an issue on the top People Search Box. It does not return any data once I followed the instruction to configure the People Search Core results web part.
    I am on SharePoint 2013 online. I did a test – if I remove “contentclass=spspeople”, the people search box works. If I put it back, it stops working. Does anyone have the same issue? Did I miss anything? Thank you for help!
    Rebecca

    Rebecca

    28 May 15 at 3:08 pm

  18. I’m using SharePoint 2013 Enterprise Edition and I also have AD sync with my users. How can I use AD instead of using the spspeople? When I put that in I don’t get any results. My users are in AD.

    Melvin

    3 Jun 15 at 6:52 pm

  19. The link above that is supposed to reference Hover panel display template doesn’t really have anything any more. However, this one does:
    https://technet.microsoft.com/en-us/library/dn386874.aspx

    Bethany Amborn

    12 Jun 15 at 11:44 pm

  20. This is exactly what i need – however my site is setup and we did not select the enterprise search center set template so when i go to create a new page i am not prompted to select the layout.

    In the look and feel section i do not have a template option.

    I do not want to start over on our site – lot of work thus far.

    Please help

    Dean Swick

    15 Jun 15 at 9:37 pm

  21. @Dean Swick you will need to activate the SharePoint Server Publishing Infrastructure feature at the site collection level and the SharePoint Server Publishing feature at the site level. You will also need to go to the master page gallery and change the following properties on the PeopleSearchResults.aspx page: Content Type = Page Layout, Associated Content Type = Page Layout Content Types – Welcome Page. You should then be able to follow the instructions to create a page using the People Search Results page layout. I haven’t tested this so would recommend trying things on a non-production site first to ensure there are no unintended side effects.

    Ari Bakker

    23 Jun 15 at 10:27 am

  22. […] a pretty simple one. I followed a great article with very detailed and straightforward steps posted here. The following article is an extension to the functionalities built within a SharePoint 0ffice 365 […]

  23. […] but I’m charged with creating an Employee Directory. I’m using the instructions in this article, but I’m a little perplexed by the […]

  24. If anyone had issue sorting by job title, here is how i fixed it. This was a great article that I enjoyed since SP2010 :)

    Khoa

    27 Aug 15 at 4:22 am

  25. Hi Ari,

    Thank you for the detailed post – it helped me create a very useful SP employee directory. I was wondering if it’s possible to display only employees from certain AD Security group? I can display employees from certain department thanks to the refinables, however, I really need a certain group of people which is already in an AD Security group.Any help/links to possible solutions/suggestions how to tackle this task will be appreciated! Thanks in advance!

    Hex

    8 Sep 15 at 2:28 pm

  26. Dear all, I found this post very nice and the idea brilliant !

    Because like most of you I need to create a Directory site for my company I decided to get use of this experience but unfortunately I’m quite stuck at beginning.

    I’m using Office 365 SharePoint online.

    As the guide, I succeed to create a SharePoint site based on Enterprise Search template and I succeed to mofify properly the properties as described. Once I created the peopledirectory page and trying now to modify this. Going to modify the Search core result Query I’m Always getting the following error:

    Sorry, something went wrong. The search request was unable to connect to the Search Service.

    Correlation ID: 2eb22c9d-5096-2000-09b5-405f647201b3

    anybody have some idea ? What I’m doing wrong ?

    Thanks in advance to all

    Brgds
    Max

    Max

    10 Sep 15 at 9:51 pm

  27. Hello Ari!

    I can’t edit the page after I create it. When I click “edit page” the “Loading…” box stays forever and never goes to the edit page.

    How can I solve this issue?

    Thanks.

    Niko

    Niko

    12 Sep 15 at 12:03 am

  28. […] a pretty simple one. I followed a great article with very detailed and straightforward steps posted here. The following article is an extension to the functionalities built within a SharePoint 0ffice 365 […]

    Niftit

    21 Sep 15 at 4:01 pm

  29. Hi

    Just like to say that this is a great idea that has worked very well for me. Like many others we have implemented this in Office 365, there are a few things to watch out for.

    All of our users have uploaded profile photos via Outlook or the Office 365 portal so I have added the users photo to the to the staff directory table using some of the suggestions in the comments above and I found that most of the users photos are not showing up or are showing. This has something to do with the way SharePoint Online interacts with Exchange Online (where the photo is stored) the users photo will only update to SharePoint Online from Exchange Online if/when the user visits there SharePoint Online my site. If the user has not visited the my site then you will not get a photo, this normal so Microsoft tell me.

    The way the photo is handled in Exchange Online and Lync/Skype Online is different so when a user uploads a photo it will show almost instantly in Outlook, Lync/Skype and the Office 365 portal. So instead of asking all my user to log into their SharePoint Online my site every time they updated the profile picture, I was able to pull the profile picture from Exchange Online using the following URL:

    https://outlook.office365.com/owa/service.svc/s/GetPersonaPhoto?email=_#=uEmail=#_&size=HR96x96

    I hope this helps other with the same issue

    Reference URLs:

    https://mysharepointlearnings.wordpress.com/2015/05/28/displaying-user-profile-picture-in-apps/

    http://www.threewill.com/user-photo-sync-behavior-in-office-365/

    Chrisw

    29 Oct 15 at 12:54 pm

  30. I have some issues with the step Adding a Table Based Layout. I uploaded the 2 files to the folder and published them but when I modified the Search Core Results web part, neither the Table Result nor the People Table Item was available. What could be the issue?

    Thanks in advance!

    Sam

    3 Nov 15 at 1:54 pm

  31. Hi Ari,

    Thank you for useful post. I have a question, How to send an email to a group of employees by using Employee Directory?

    Thanks,

    Katan

    18 Nov 15 at 5:37 pm

  32. On table format, is there anyway to include pictures too? Or in picture format, is there any way to include workphone number and office location?

    adit

    7 Jan 16 at 6:43 pm

  33. Hi All
    can we display only name and date of birth of all the user

    Saani

    20 Jan 16 at 6:15 pm

  34. I am having issues displaying anything when typing in the code as above. Any further advice?

    Martin

    28 Jan 16 at 2:17 am

  35. I want to add MobilePhone but it is not working. I have check the Profile permissions and everyone can read the MobilePhone Property. I am using: _#=ctx.CurrentItem.MobilePhone=#_

    What am I missing?

    Doug

    28 Jan 16 at 3:47 pm

Leave a Reply

*