I followed How to: Create a Simple SharePoint 2013 People Directory to create a search result for our employee directory. I used a basic "department:departmentname" refiner to show the results from one particular department, which seemed to work fine.

Unfortunately, I found out afterwards that because our 5,000+ employees AD is so messy - people spell their department name wrong, abbreviate it or write it in various non-standard ways - these results are inaccurate and we end up missing a lot of people in the results.

How would you go about writing a web part query statement that finds all of these random people in several different departments within AD? We know most of the AD misspellings, patterns and abbreviations, but now we just need to write the proper query to grab them.

Or is there another way to get the results I'm after?


1 Answer 1


There are a couple of different ways to tackle this problem but ultimately you, meaning your organization, need to regain control over important fields like this so that the technology can do what it's meant to do. If anyone is able to change this field in the future, then anything you do is going to be only a temporary patch.

  1. Make the field a fully managed property (read only to employees) and use BCS to fill in the field with data from your HR department's management software (PeopleSoft, etc). I have described the steps to do this without code in this SharePoint SE answer. The advantage of this is that HR is in full control. If an employee changes departments, the entry will be up-to-date after the next sync. This has the disadvantage of requiring some sort of custom code. Either BCS or something else that will manage the synchronization.
  2. Make the field editable but backed with data from the Managed Metadata Service so that employees can only choose from the approved list of departments that is managed and maintained in SharePoint by the HR department. This has the advantage of having alternate labels so that if someone types IT they will get Information Technology. It has the advantage of not having to develop custom code, but still leaves it up to the employees to change keep it up-to-date.
  3. The quick and dirty would be to use PowerShell and to export all the AD entries to a CSV and then script the clean up of the Department field so that you got as close to 100% as you could without making this a full-time job. Then use the cleaned up CSV to update AD via PowerShell again.

I'm not sure if others here might have some suggestions for you, but you are not the first nor the last person with this exact problem so you can probably find lots of blog posts relating to this topic in some way.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.