- Create a Simple SharePoint 2013 Employee Directory on Office365 – Part 1 – Introduction
- Create a Simple SharePoint 2013 Employee Directory on Office365 – Part 2 – Set up an Employee Directory Page
- Create a Simple SharePoint 2013 Employee Directory on Office365 – Part 3 – Create Display Templates
- Create a Simple SharePoint 2013 Employee Directory on Office365 – Part 4 – Search Schema
- Create a Simple SharePoint 2013 Employee Directory on Office365 – Part 5 – Sorting & Refiners
The first step is, of course, to create a page where the Employee Directory will live. The approach we’re taking here is to use a page in the Search Site Collection in Office365. By default – at least in the tenants I’ve worked with – the Search Site Collection lives at
https://[tenant name].sharepoint.com/search. This isn’t a sneaky hidden Site Collection like the ContentTypeHub (See: Hidden Content Type Hub on Office365 Tenants), but one that lives right out in the open.
When you go to the Search Site Collection directly, you’ll land on a very bland search page:
You may also have created your own Enterprise Search Center, which may look a little different. It doesn’t really matter, though. All we want to do is to create a new page in the Search Site Collection you are using to house the Employee Directory.
Click on the cog (See the cog on the left as of this writing. It’s not unlikely that it’s taken on a new shape or color since then.) and then Site Contents. This should show you all of the
Apps lists and libraries available in the Site Collection root. If you can’t get this far, then you may not have the appropriate permissions. Go directly to Jail, do not pass Go, and do not collect $200. You’ll need to talk to your Tenant or Site Collection Administrator to get the right permissions.
If permissions aren’t a problem, then click on the Pages
App Library icon.
Once in the Pages library, go to the ribbon and create a new page.
When you select Page, you’ll end up on the page where you can create the page. What you’re looking for here is the “(Welcome Page) Search People” page layout. In the image below, the page layout is not available. If it is, choose it and keep rolling. If not, first take this little detour.
Click on the cog, go into Site Settings, and choose “Page layouts and site templates” under the “Look and Feel” section at the top of the right column. (For some reason, even when I know where something is on this page, I have a tough time spotting the right link: everything looks the same. My trick is to use Ctrl-F in the browser to search for the right word rather than just scanning for it.)
In the Page Layouts section, add the “(Welcome Page) Search People” page layout.
The section should then look like this:
Now go back to the Pages library and create a new page. I’m calling mine “Employee Directory” with the URL set to Employee-Directory.aspx. Be sure to choose the “(Welcome Page) Search People” page layout.
When you click Create, you’ll end up back in the Pages library. Click on the Employee Directory page. It’ll look something like this, though if you see my photo it’ll be a little weird.
Believe it or not, you now have a fully functional page that will do much of what you want. For instance, if you type “Lastname:A*” in the search box, you’ll get all of the people whose last name starts with the letter A.
But we don’t want to land on the page with nothing showing. That would require more work than we want people to do. Instead, let’s set the Search Results Web Part up so that it shows some of the people in the tenant by default.
Click on the cog and Edit Page. If you’ve never done this on a Search Results page before, you may be surprised to realized that it’s just a Web Part Page with some special Web Parts already set up for you. You’ll see that you have two Web Part Zones.
- On the left, you have the Navigation zone. It contains only one Web Part: the Refinement Web Part
- On the right, you have the Main Zone. It contains two Web Parts: the People Search Box Web Part and the People Search Core Results Web Part.
There’s a great deal we can do with these settings, but for now we are going to just do one simple thing. Click on the Change Query button. In the Query text box, simply add contentclass=spspeople. This sets the default search to return all people, filtered by whatever is in the search box. If you click the Test query button, you should see at least a few people show up on the right in the Search Result Preview box.
Click OK to save the query, OK to save the Web Part settings, and Save on the ribbon to save the page. Now you should have a very rough first pass at an Employee Directory. You should see up to 10 people in the results, perhaps along with a photo (if they have one in their profile) and a little information about each person (if certain profile properties are populated). You my also see some strange “people-like” entities. These will usually be some crawler accounts, etc. We’ll take care of those later.
Whew. That’s probably enough for now. If you want to, try adjusting some of the settings in the Tool Pane for the People Search Core Results Web Part, but don’t go too crazy. In the next post in this series, we’ll look at how we can make some changes to the Display Templates so that our results are more helpful and robust.
Note: Mikael Svenson (@mikaelsvenson), my search guru and Jedi master, pointed out to me that adding contentclass=spspeople isn’t actually necessary. Once we have some other criteria in the search query, we won’t need it there. However, at this point since we don’t, and we’d like to see some people in the results, it serves a purpose.