Recently quite a few of my customer asked me to build a staff directory. There are some variations but the general story is utilise the information stored in SharePoint’s user profiles.
So here are the steps to create your own staff directory:
1. Make sure that the User profile import from AD is working
I want to have the following fields included so I’ve created an AD account with the following fields populated:
- Photo (named thumbnailPhoto in AD)
- Name (named Full Name in AD)
- Office (named Office in AD)
- Extension (named IP Phone” in AD)
- Direct Number (named Telephone in AD)
- Mobile (named “Mobile in AD)
- Job Title (named Job Title in AD)
- Department (named Department in AD)
- Fax (named Fax in AD)
This is where the fun started how do we get that photo to appear in SharePoint. AD stored the photo as a binary and SharePoint as a URL.
I followed Richard’s steps but still no luck. I only got this to work once I switched back to SharePoint Profile Synchronization rather than SharePoint Active Directory Import.
2. Run a full search crawl on your user profiles
I like to separate my search sources a bit so that a full crawl of the user profiles doesn’t mean a full crawl on all of the content data.
Before running a full crawl make sure that the fields that need to be displayed in the staff directory have Searchable, Refineable, Sortable ticked.
3. create a new page
Go to site settings -> New Page
4. add web parts to the page
Add a search box, a refiner and a search results web part the created page.
5. update the display templates
This is the most difficult part and will require some development skills.
Collect a copy of the following display templates:
make the changes as required to the display templates. Make sure that you rename the html files that you downloaded and update the title inside the file. Create a new folder in the display templates folder and upload your modified version display templates.
6. Configure the query and display templates in the results web part
Edit the page and edit properties of the results web part. Adjust the query and select People Results. Click on test to see that you’re getting some results back.
Select the display templates that you uploaded in step 5. Click apply and Ok.
7. Select the refiners in the refiner web part
Edit the web part properties of the refiner panel. Remove all refiners and add Department, Office and Job Title.Click apply and Ok.
Publish the page and all should now look like a staff directory that can be used.
Ok so these are the manual steps. Can this be done any quicker? I have made my solution deployable. So all I need to do is upload the wsp (I’ve created a sandbox solution for this). Activate a feature and my Staff Directory page is ready.