Wednesday, 23 August 2017

SharePoint People Search with custom AD Properties

If you have a custom AD property and it is mapped to user profiles, but if you would like to search people with that property, you should follow the SharePoint search syntax.
The syntax is PropertyName:Value 
Ex: DeskNumber:D005

Problem with this is that
  1. You must follow the syntax
  2. You can not search for part of the value, it should be full-text value.

Quick Solution:
There is a quick tricky solution to come out of this drawback.

1. Open People search page (as administrator)
2. Click Edit page from settings gear.

3. Edit the People Search Core Results web-part

4. Click Change query button

5. In the Query text box: 
Put all of your combinations: starts with, end with etc., with OR/ AND logical conditions.

contentclass=SPSPeople {searchboxquery} OR MyCustomProperty1:A{searchboxquery} OR MyCustomProperty2:{searchboxquery}A OR MyCustomProperty1:{searchboxquery}  OR MyCustomProperty1:AB{searchboxquery}

6. Click OK, save and check-in the page; you are done!

Hope it helped you:) thank you