Use SharePoint Search and the User Profile Service to build a SharePoint Company Directory that is available to all employees of the organization. This feature is common in Intranets and can be built using only out-of the box features.
User Profiles and the User Profile Service in SharePoint
You will need to be a SharePoint Administrator to follow-along with these steps. If you’re not a SharePoint Administrator, partner up with your IT team.
The goal is to build a search for people that returns their Picture, Name, Department, and Work E-mail. Something like this:
This information is coming from the SharePoint User Profile Service:
You’ll find a variety properties that define a user (just like the properties on a document, list item, site page, etc.) after going to ‘Manage User Profiles’, and looking up a name:
In order for this solution to be successful the backing data must be accurate.
For this example, SharePoint Search will be used to source: Name, Department, and Work Email (not shown in the image above) from the User Profile Service.
Building the SharePoint Company Directory Search Page
Read the blog posts on Office 365 and SharePoint – Sales Contract Lifecycle Management (CLM) if something I cover below is unclear. Here are other helpful posts on topics to read before continuing:
- Adding pages with web parts. The subject is covered in depth…particularly in this post.
- Keyword Query Language (KQL) and managed properties in the Content Search Web Part – here.
In advance, here’s the query we’ll use the following KQL value for the Content Search Web Part:
Note that WorkEmail is automatically promoted to a managed property from the People content type.
The query above reads, “All results filtered by anything matching the SearchBoxQuery (even empty) and where WorkEmail contains ‘@contoso.com”.
So, why filter on “WorkEmail contains ‘@contoso.com'”? The “Select a query” filter, set to “Local People Results (System)” in the CSWP, returns the following without the WorkEmail filter.
There are objects in SharePoint that are of the “People/Person” content type, but they are system accounts and not actual valid employees. Fortunately, they don’t have e-mail WorkEmail addresses in their user profile, and all valid employees do. Therefore, we add a filter on WorkEmail:@contso.com and see the expected results:
Now, add an ascending sort by Last Name (i.e. the LastName managed property):
Finally, set the Property Mappings on the “Picture on left, 3 lines on right” Display Template. Increase the number of items to show:
Validate the SharePoint Company Directory and People Finder
The Company Directory and People Finder have been built using all out of the box properties and settings in the Content Search Web Part.
Below is a demonstration in a test environment with two users in the User Profile Service.
As always, there is more than one way to build this solution. You could use the standard Search Results web part as another option. That solution might need Display Templates altered to get the information you want, but it comes with features such as “related people” and the Profile Hover Panel. Here you can see a screen shot using the standard Search Results web part. This includes Name, Title, Department, “Ask me about”, Interests, and the hover panel with links to related data:
This demonstrates that you have a choice. You can build either version of the SharePoint Company Directory with standard / out-of-the-box features.
Now check out this post to complete the directory and add SharePoint “Ask Me About” and “Interests” to the results.