In Office 365 SharePoint, a company directory is useful for all employees, so when reading this post, the intent is not to imply that the Company Directory and People Finder we see in this blog post is only supposed to be used by Human Resources (HR). Instead, Human Resources will leverage SharePoint Search to build a company directory in Office 365 that is available to all employees of the organization. This is a common feature in Intranets, used in many business management scenarios, and can be built using only out-of the box features.
Reviewing User Profiles and the User Profile Service in SharePoint
In this first demonstration, you will need to be a SharePoint Administrator to follow-along with these steps. If you’re not, partner up with your IT team to validate. The goal is for the Human Resources team to build a quick search for people that returns their Picture, Name, Department, and Work E-mail. Something like this:
But, where will the HR department get this information from? From the SharePoint User Profile Service:
After going to ‘Manage User Profiles’, and looking up a name, you’ll find a variety properties that define a user (just like the properties on a document, list item, site page, etc.).
Now the key to success with these profiles is that they must be kept up to date. If you work for a large organization, this will very likely be managed by Information Technology, and as a Human Resources representative, you won’t need to worry about these properties. But, if you’re from a smaller organization, you may in fact be charged with keeping these properties updated. If the users’ profiles are not updated and accurate, then your people finder and company directory will be outdated an inaccurate.
For this example, SharePoint Search will be depending on the following properties to populate the Company Directory: Name, Department, and Work Email (not shown in the image above).
Building the SharePoint Search Page
Even though this post is tailored to Human Resources (HR), you should read the blog posts on Office 365 and SharePoint – Sales Contract Lifecycle Management (CLM) if the subject matter which I don’t cover in depth below is unclear. In particular here are other helpful posts on topics referenced. Please have read:
- 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.
Now, terms like CSWP, KQL, managed property, etc. should all be familiar. Let’s continue…
In advance, here’s the query we’ll use the following KQL value for the Content Search Web Part:
Also, in advance, note that WorkEmail is automatically promoted to a managed property from the People content type.
Okay, our query above reads, “All results filtered by anything matching the SearchBoxQuery (even empty) and where WorkEmail contains ‘@contoso.com”. So, in the case that a user doesn’t specify a search query, we’ll be pulling all People that have ‘@contoso.com’ in their Work Email address.
So, why are we filtering on “WorkEmail contains ‘@contoso.com'”? If the Human Resources team configured the “Select a query” filter to the “Local People Results (System)” in the CSWP, look at what’s returned without a WorkEmail filter.
There are a bunch of 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 now we see what we expect:
Now, let’s add an ascending sort by Last Name (i.e. the LastName managed property):
And, finally, we’ll set the Property Mappings on the “Picture on left, 3 lines on right” Display Template, and increase the number of items to show:
Validate the Company Directory and People Finder
With the Sales Contracts Quick Search that the Westmorr Sales team finished in this post, they had to modify the Display Template in order to get the results the way they wanted. Here, Human Resources (HR) was able to get the Company Directory and People Finder built using all out of the box properties and settings in the Content Search Web Part.
Let’s watch a validation run. This is a test environment, so there are only two proper users in the User Profile Service.
And, as with many other posts in the Business Management series, there is more than one way to build this solution. You could use the standard Search Results web part too, which might need its Display Templates altered to get the information you want rendered, but 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 with Name, Title, Department, “Ask me about”, Interests, and the hover panel with links to related data:
We’ll be able to watch Human Resources (HR) continue building out their sites over the next few posts.