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 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.
Click on the dropdown at the top right of the People Search Core Results Web Part and choose Edit Web Part. This will open the Tool Pane for the 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.
Hi Marc, glad to see this series. One question, when I set up the search page with the added query in the web part settings, I noticed that when I am on the page again and I type in the “Lastname:A*” query in the search box that it no longer finds people. Is this expected behavior?
I’m not sure what’s going on there, Jonathan. The obvious question would be whether you have someone with their last name starting with A, but I’m sure it’s not something that simple.
Where I’ve left off in this post, my query looks like: {searchboxquery} contentclass=spspeople. If yours matches that, then you ought to be getting people back from searches.
M.
Thanks Marc,
I figured it out, classic case of rushing through, I was missing the space in the query.
Johnathan
Hello, In Page layouts and site templates I dont find “(Welcome Page) Search People”. I created the site as Enterprise Search Center. I have Sharepoint 2013 Online in Office 365
@Pablo:
Did you take the suggested detour?
M.
Yes, here the screens:
http://i65.tinypic.com/2vs3tqe.png
http://i66.tinypic.com/2gsjwxu.png
http://i66.tinypic.com/2ntd849.png
@Pablo:
Unfortunately, I’m not a Spanish speaker so I’m not sure which of the page layouts in your second picture is the correct one. It’s possible that your Spanish installation calls it something different or doesn’t include it at all.
M.
Hello, I have set the query and apply changes in the properties of the results. However, when I save changes on the page, automanticamente changes are lost and does not show the results. Back to see the query and see that no there I created. What could be happening in Sharepoint?
@Pablo:
It sounds like you are doing things correctly. I’m not sure what to suggest.
M.
Pablo,
Not sure if I can help. But can you send a screen shot of your query page with your query typed in? I don’t speak or read Spanish though but hopefully the layout is not to different.
Here the images:
[IMG]http://i64.tinypic.com/af7h38.png[/IMG]
[IMG]http://i66.tinypic.com/jtmjgh.png[/IMG]
[IMG]http://i63.tinypic.com/9kc7e9.png[/IMG]
The query displays the results, but when I save the page no longer shows any. In theory, it should show 10 results.
In other words, changes in the Web Part do not keep after you save the page.
http://i64.tinypic.com/af7h38.png
http://i66.tinypic.com/jtmjgh.png
http://i63.tinypic.com/9kc7e9.png
@Pablo:
I’m not sure why your changes wouldn’t save. It could be a permissions thing or something else.
M.
Welcome People Search is not showing up
@Lito:
I give you the steps to enable it in the post.
M.
I like this very much and it works fine with SP 2016 on Premise. Is there any possibility to use A-Z for other WP also, ex. any List on Document Libraries??
@Andrea:
The answer sort of has to be yes, but the way you might do it will be different depending on what you are trying to accomplish.
M.
Is this still relevant to SharePoint Online?
I found Hyperfish’s guide which brought me to your original guide. I don’t get any people returned on any form of search either on the standard SP search or when I create the new page. I’ve checked the query and it shows 0 when testing.
We use AADC to sync users, the SharePoint webpart for People works fine, but I’m now trying to create a directory listing alongside it.
thanks for the help.
@Luke:
This all should work in SharePoint Online, but obviously in the classic Search Center. You should get results given the way you describe your setup. Is it possible you added something to the query which doesn’t get a match? Try deleting the query and starting from scratch.
M.