SharePoint Corporate Directory in Under 10 Minutes

SharePoint Corporate DirectoryDuring all the SharePoint projects that I’ve been involved with the thing we always have lengthy discussions on is quick wins. A quick win is something that takes very little time, low cost and an impact that spans throughout the company. Sounds simple enough doesn’t it? Well its not because each company has their own opinion on what that might be and an understanding if the users will actually use it. So after many sleepless nights, less than acceptable quick wins and my burning desire to find a few of what I call “GO TO” quick wins I finally have a few things that have worked repeatedly and I couldn’t be happier and the clients are ecstatic. Even though I would love to talk about all the ideas I have come up with in this blog we are just going to focus on the one that has seemed to have the biggest impact the “Corporate Directory”. No worries I will do other blogs to cover some of my other quick win ideas so just hold tight for those.

A Corporate Directory is used in EVERY company out there; however, most of the time when I walk in the door it is manually, being updated every week by the receptionist, sent out via email and then printed by various individuals and posted on the walls in their cubicles. Sound familiar to you? It should because it can’t just be all the companies I walk into :). One of the things I thrive to achieve with all clients is showing them ways to automate manual processes and I just don’t mean the really complicated stuff think about the things little ones too; you know the ones that don’t take a lot of time but yet still take time. The corporate directory is exactly that!!! It takes very little time each week to make updates and send out an email but what if you didn’t have to do it at all and it was just there and updated automatically as soon as HR reports to the IT team that there is a new user to be entered or via another automated process someone puts in a employee updated into some system. Sounds awesome right?? I know it does so you might as well woot woot now!!

In this blog I explain how to utilize SharePoint out of the box functionality to create a corporate directory in under 10 minutes!! If you want to get a little more crazy you can modify it to the next level in about 30 minutes and showing it off to everyone in your company :). I hope that sounds like a great idea but I think its awesome so here we go!

As an administrator pull up your company SharePoint site and go to your Search a url that probably look something similar to http://portal.domain.com/sites/searchcenter. From there follow the directions below and you will be off to creating an amazing Corporate Directory.

Making the layout available:

  • Site Settings
  • Look & Feel
  • Page Layouts & Site Template
  • (Welcome Page) Search People in the Page Layouts section.

Stacy _blog2

Adding new page:

  • Search Center
  • Select Files
  • New Document
  • Select Page

Stacy _blog3

Select the new layout added:

Stacy _blog4

Now to create some magic ok maybe just a quick and simple built in query.

  • Edit Page
  • Edit People Search Core Results Web Part
  • Select Change Query
  • Property Filter: ‘contentclass’
  • Equals à Manual Value à spspeople

Stacy _blog5

Optional Refinement:

You can change these to show other metadata properties that are defined in the search center by selecting the ‘Choose refiners’ option on the refinement web part. The managed property must have the ‘Refinable’ option selected in the search schema for it to be available in this list.

Stacy _blog6

Adding Sort Options (Optional):

  • Edit Page
  • Edit People Search Core Results Web Part
  • Check “Show sort dropdown”

Example (First Name, Last Name & Location):

[{“name”:”First Name (A-Z)”,”sorts”:[{“p”:”FirstName”,”d”:0}]},{“name”:”Last Name (A-Z)”,”sorts”:[{“p”:”LastName”,”d”:0}]},{“name”:”Location”,”sorts”:[{“p”:”Location”,”d”:0}]}]

What it will look like:

Stacy _blog7

Note: Ensure that the managed property you want to sort by has the Sortable option enabled in the search schema. Search Service Application, Search Schema, Select the LastName managed property and select the Sortable: ‘Yes – active’ option (do the same for all properties you want to sort). Note you will need a full crawl for this to take effect.

#Bam #Boom Check it out…

By default you will have the users full name, their title and their department displaying all nice for you. However, you all know that this is the tip of the iceberg as if this is going to be a TRUE corporate directory they are going to want some more information to display so make sure you read on in this post :). #10minutesdone

Stacy _blog8

Updating Search Display Template:

  • From the Corporate Directory navigate to Site Settings. In the Look and Feel section chose Design Manager.
  • In Design Manager choose Upload Design Files.
  • Click the link at the top of the page to open the Master Page Gallery in Windows Explorer.

Stacy _blog9

Browse down the folder structure to Display Templates/Search/ and locate the Item_Person.html file. This is the file used for the out of the box People Search result. Notice that there are actually two files named Item_Person. We always work with the HTML file leaving SharePoint to manage the JavaScript file.

Stacy _blog 10

  • Copy the Person_Item file to your desktop and rename it to Corporate_Direct_People_Item (this way when we copy it back it won’t overwrite the original file.)
  • Now open the file in a text editor and find the title tag. Change the title to Corporate Direct People Item.

Stacy _blog 11

  • In the next section are a bunch of tags that begin with <mso. These control the metadata for the Display Template. The one we’re interested in is the ManagedPropertyMapping tag. We need to add any new custom properties to this tag before we can display that property in the page. This is where you have to decide what Managed Properties from the Search Service you are going to use in your page. In this case, we will need to find what Managed Property that is being used, In the Use Case their wanting to find what is being used for their Cell Phone.

<mso:ManagedPropertyMapping msdt:dt=”string”>’MobilePhone’:’MobilePhone'</mso:ManagedPropertyMapping>

  • Update Variable:

We gave it: var has_cphone

Then, Paste in the following code:

<!–#_

if(has_cphone == true) {

_#–>

<div id=”MobilePhone”>

<!–#_

var encodedcphone = $htmlEncode(ctx.CurrentItem.MobilePhone);

var displaycphone = Srch.U.getSingleHHXMLNodeValue(hhProps, “MobilePhone”);

if ($isEmptyString(displaycphone)) { displaycphone = encodedcphone }

_#–>

<div id=”MobilePhoneValue” class=”ms-srch-ellipsis” title=”_#= encodedcphone =#_”>Mobile: _#= displaycphone =#_

</div>

</div>

<!–#_

}

_#–>

  • Save the file, close, and that’s it!

Now one last step for all the greatness to appear and be available to your users and you become a #Rockstar to all that know you.

Upload and Apply New Display Template

  • Click and drag the new display template file to the mapped directory
  • After it is coping, go back to Design manager, you will see that the file should have a status of ‘Conversion Successful’
  • Publish a major version
  • Go to the Corporate Directory Page and edit the page
  • Edit the ‘Search Results’ webpart
  • In the WebPart Properties, click Display Templates
  • Choose, ‘Use a single template to display items
  • Choose the ‘Corporate Direct People Item’ template
    • Hit Save
    • Publish the page

Sample Display Template: Item_Person (Includes Phone Info & Email)

Enjoy being the #Rockstar we all know and love!!

Example of Ext and Email

Stacy _blog 12

Example with Phone & Email…

Stacy _blog 13

In addition here is a link to the full presentation that have done at many SharePoint Saturday events & User Groups: UserProfiles_FullDemo

This article originally appeared on SharePoint Mind Melt here.

About the Author:

Stacy _bioStacy Deere-Strole is the Owner of Focal Point Solutions LLC, a Cincinnati, OH based company that provides SharePoint Solutions for the Enterprise in the mid-to-large market. Previously, Stacy led a rapidly growing SharePoint practice where she engaged in a wide range of consulting projects across various industries. With nearly 18 years of experience in the IT Industry, Stacy has mainly focused on Collaboration Solutions such as IBM’s Lotus NotesDomino and Microsoft’s Messaging and Collaboration Solutions including deployments and SharePoint upgrades. Stacy is actively sharing her real world expertise through authoring in the blog http://www.spmindmelt.focalpointsolutions.co and speaking at various SharePoint Saturday’s, Information Governance Conference, SPTechCon and User Group events. She also co-authored two books called SharePoint 2013 and 2010 Using Managed Metadata.

Follow Stacy on Twitter here!

Share this on...

Rate this Post:

Share: