How to create a custom SharePoint 2013 People Directory

In this article I explain two alternative solutions for creating a “who is who” or People Directory page in SharePoint.

Solution 1
The first solution is to create a Search People Page, which is a standard page layout in SharePoint. 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.

sharepoint-people-directory

Also things like sorting and refinement can be configured. See this link for more details:

http://www.sharepointconfig.com/2013/05/how-to-create-a-simple-sharepoint-2013-people-directory/

In order to customize the view you could modify the existing Display Templates or create your own Templates. These links are a good starting point for creating your own templates:

https://msdn.microsoft.com/en-us/library/office/jj945138.aspx

http://www.ableblue.com/blog/archive/2013/06/05/introduction-to-sharepoint-2013-display-templates/

Although the first solution works, I personally find creating Display Templates a hell of work and quite complex to modify. The front-end programmers without SharePoint knowledge find them even more worse. As a fact I hardly know any programmer that likes to create or modify Display Templates for fun! Beside these the business often requires different or custom functionality which might not be available in standard out of the box SharePoint Search Webpart.

Solution 2

Create your own custom Page Layout, build your own custom Client Side Components and use SharePoint Client Side Object Model CSOM (C#) or JSOM (JavaScript) to call the Search API. This way your hands are not tied with SharePoint Frontend limitations and you will be able to create a much user-friendly People Page.  An example of such a custom Page is shown below. (Please leave a message or send an email to receive the source code.)

customPeopleDirectory

Here are some useful links for creating search queries with SP Client Object Model (JSOM and CSOM):

http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2013/04/18/how-to-query-search-with-the-sharepoint-2013-javascript-client-object-model.aspx

http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2012/09/10/how-to-query-search-with-the-sharepoint-2013-client-object-model.aspx

http://www.c-sharpcorner.com/UploadFile/sagarp/how-to-search-for-people-as-a-search-scope-content-source/

http://social.technet.microsoft.com/wiki/contents/articles/25074.sharepoint-online-working-with-people-search-and-user-profiles.aspx

https://msdn.microsoft.com/en-us/library/office/jj163800.aspx

Good luck with coding!

Leave a Reply

Your email address will not be published. Required fields are marked *