Wildcard People Search on MOSS 2007
Written by Ramon Scott on July 8, 2008 – 6:34 pm -Unfortunately out-of-the-box Microsoft Office SharePoint Server 2007 does not play nice with wildcard searches. This is particularly troublesome when searching for people with hard to spell names.
Here’s a quick solution for a adding a web part to the home page that allows for searching for people using first, last or a combination of names. Wildcards are supported on either.
So, entering a first name of Rob would return results for Rob, Robert, Roberta, Robbie, etc. Likewise, a last name search for Smit would return results for Smith, Smits, Smitkerson, etc.
To use this, just add a content editor web part to the moss home page and paste the code below into the source view. The form will submit to the default people search results page.
Tags: MOSS, SharePoint, WSS
Posted in SharePoint |

July 18th, 2008 at 8:34 am
How would you add an additional field for Department to perform wildcard searches?
July 22nd, 2008 at 12:13 am
Hi, thanks for the excellend post, its very good solution for wildcard search. But I have a slightly different scenario. The client doesn’t want separate text boxes for first name or last name or any other property. There is a single textbox similar to the standard search webpart, and in that want to incorporate the wildcard search. Any ideas for that, or how I can modify script as given by you. Any help would be more than welcome. Thanks
July 30th, 2008 at 7:27 am
Excellent post…very simple…the only problem I have is that with the results, the formatting of all of the employees information is non-existent…it is one long string of information. Do you know where I might make the changes, or what changes TO make on the peopleresults.aspx page so that the formatting is correct?
September 18th, 2008 at 2:43 am
hii .i tried this people search but it is working for only my detail is displaying not others.Is there any other settings to be done in peoplesearch result page?pls reply me in detail.
September 18th, 2008 at 2:49 am
where i should add the details of the people.
September 22nd, 2008 at 6:38 am
Is there a way to search for phrase endings? All wildcard solutions offer only begining phrase search.
If I had a telephone number string like: 984395857883 and tried to search for extension *883 in MOSS can I do it at all?
September 23rd, 2008 at 2:38 am
Hi Ramon,
I modified your code to enable wild card search on PreferredName (e.g. Kelvin Chris) instead.
I entered “Kelvin” but there isn’t any result.
Any idea?
Thank you in advance!
September 26th, 2008 at 7:06 am
I like your example of a division dropdown, but does wildcard searching work on something like Skills and Responsibilities? I tried passing skills:”C” to the peopleresults page and it only returns exact matches. Is there some configuration that needs to be changed?
October 23rd, 2008 at 12:50 pm
Thanks for this post,thats what i was exactly looking for.
October 24th, 2008 at 12:02 pm
I followed your other post where you show how to search by other fields but having a problem in there.
I have added Department field and made it as a text box instead of dropdownlist but it only return results if we provide the full department name.Its not doing the wild card search the same way its doing for first and last name. could you please show us how to do wild card search on other fields also like department.
October 27th, 2008 at 2:07 pm
This is fantastic. Thank you.
I have one question.
If I use this code on the actual “peopleresults.aspx” page (by adding a content editor webpart there), is there a way to have those fields filed out with what they searched on. by default, the get cleared each time. Can this be pulled from teh url using javascript and populated back into the form? Thanks.
November 5th, 2008 at 10:30 am
Raj -
You need to remove the quotes from the search term - to get the wildcard to work
skills:C
make sure there is no space between the catgory and the term
November 10th, 2008 at 6:01 am
Hi Ramon - Do you by any change have a similar code for ordinary (not people search) wildcard-search in MOSS 2007?
December 8th, 2008 at 11:07 am
This is great code! However, has anyone encountered a problem where the apostrophe in a person’s last name, like O’Brien, causes an error, or no person found?
I’m researching ways to fix this. The double single quotes and the %22 doesn’t work in our farm. The same issues occurs on the Site Contact link. It breaks for a name with an apostrophe.
Any suggestions?
March 4th, 2009 at 10:04 pm
Great quick and easy soltuion
March 31st, 2009 at 8:29 pm
Just had to configure it to point to the correct site since mine’s not set up as the default, and it works like a charm! Thanks for the code.