December 27, 2009

SharePoint People Search Autocomplete

Back in July, Jan Tielens demonstrated how to write an autocomplete mechanism for SharePoint search. Muhimbi then proposed a greatly enhanced version 2.

In our version, we have enhanced the code just a little to enable the following:

  • paging: you can display results n at a time, and offer a link to go to the next page


  • sorting: allow users to refresh results by alphabetical order, by department, etc. (you can add your own sorting criteria)


  • search across all people metadata:  let people either search on name, skills, office number, phone number, or any other indexed metadata you include in the search query


  • Rich formatted results: display picture, presence awareness (Office Communicator) and links to internal or external systems (Yammer, Skype, Facebook, etc.)


  • Refine search results: allow users to click on any metadata on the autocomplete search to drill down into specific criteria


Example of the final result:


To implement this version of the people search autocomplete, copy the code below, modify it as you need (mandatory: modify the server name), and paste it on a Content Editor web part.


  1. Hi,

    This is great. I am not so good with Javascript, but is there a possibility to somehow group the results by, for example, searchscope?



  2. Hi,

    I have tried your code below but in the code file there are no comments about how your query was structured or anything of the sort.
    Can you please send me a breakdown of where you got the user info as well as how the info is retrieved from SharePoint. I am relatively new to this.

  3. My favorite tool to build my XMl Queries is this codeplex tool:
    Hope this helps.

  4. Hi ,
    I am not able to find the script for people search.Ca you please provide the link to get the script

    1. It's the yellow folder at the end of the post. Or use this URL:!1830&parid=4B4456F418BC36F2!722&authkey=!