MS Project, MOSS + 70 custom fields for your task lists!
Powered by MaxBlogPress  

Get a free email account @sharepointbuzz.com
Sign up
Check e-mail

SharePoint Online
SharePoint BUZZ Logo

How To Extend Wildcard People Search on MOSS 2007

Ramon Scott just posted on his blog on how to perform wildcard people search on MOSS 2007.  His script example, shows how to search for First Name and Last Name.  After reading some of the comments, many were wondering how to implement search on additional search fields.

That’s when I remembered, I had a similiar solution for a client last year; so I figured I’d show you how to extend the wildcard people search in MOSS 2007 to include additional fields other than First Name and Last Name.  At the end of this article, I have included the full script that you can copy into a content editor web part and enable your company to perform wildcard people search.

Wildcard People Search on MOSS 2007 Extended Image
By the way, if you haven’t already, check out my article on how to enable people search in MOSS 2007.

Helpful Functions

For this example, I have included a drop down list containing the Division / Business Unit the user is part of,  their Job Title, and any additional Keywords you’d like.   As an added bonus, the drop down list for Division / Business Unit is prepopulated from a list library column that you can specify using the function RepopulateList.  It takes three parameters:

(”DivisionDropdown”, “”, “{868c5154-983d-4e0e-be08-b905e975edd9}”, “ows_LinkTitle”)

  • controlName - name of the input control you’d like to populate.  In this case,we have our drop down list name and id parameter set to DivisionDropdown
  • siteName - the directory of the site where owssvr.dll can be found.  If this is a root site, set it to “”
  • lookupListName - the GUID of the list
  • textField - the name of column that you would like to retrieve data from

function PeopleSearch()
{
var oKeyword = document.getElementById(”KeywordInput”);
var oFirst = document.getElementById(”FirstNameInput”);
var oLast = document.getElementById(”LastNameInput”);
var oDivision = document.getElementsByName(”DivisionDropdown”);
var oTitle = document.getElementById(”JobTitleInput”);

if(oKeyword == null) {return;}
if(oFirst == null) {return;}
if(oLast == null) {return;}
if(oDivision.length <= 0) {return;}
if(oTitle == null) {return;}

var sKeyword = oKeyword.value;
var sFirst = oFirst.value;
var sLast = oLast.value;

// Build URL so peopleresults.aspx can understand - code emitted
}

function RepopulateList(controlName,siteName,lookupListName,textField)
{
var listEl = document.getElementsByName(controlName);
if(listEl.length > 0)
{
listEl(0).innerHTML = “”;
var opt = document.createElement(”OPTION”);
listEl(0).options.add(opt);
opt.innerText = “”;
opt.value = “”;

//get the list
var reqstring = siteName + “/_vti_bin/owssvr.dll?CS=109&XMLDATA=1&RowLimit=0&List=” + lookupListName;
var req = new ActiveXObject(”MSXML2.XMLHTTP”);
req.open(”GET”,reqstring,false);
req.send();
//load response in XML Document
var doc = new ActiveXObject(”MSXML2.DOMDocument”);
doc.loadXML(req.responseText);
var data = doc.documentElement.childNodes(1);
for (i=0;i<data.childNodes.length;i++)
{
var optionText = data.childNodes(i).attributes.getNamedItem(textField).value;
var opt = document.createElement(”OPTION”);
listEl(0).options.add(opt);
opt.innerText = optionText;
opt.value = optionText;
}
}
}
</script>

<select id=”DivisionDropdown” name=”DivisionDropdown” class=”ms-input” style=”width: 207px”><option value=”"></option></select>
<script language=”javascript” type=”text/javascript”>
if(typeof(RepopulateList)==”function”){RepopulateList(”DivisionDropdown”, “”, “{868c5154-983d-4e0e-be08-b905e975edd9}”, “ows_LinkTitle”);}
// Change bolded text above to GUID of your list
</script>

UPDATE:  I have also noticed that Patrick Tisseghem wrote about a similiar solution on how his blog titled Filtered Lookup Lists in SharePoint.
Download file - Wildcard People Search on MOSS 2007 Extended

"How To Extend Wildcard People Search on MOSS 2007" was published on January 24th, 2008 and is listed in Enterprise Search, Pages and User Interface, Search, Services, Tutorial, User Interface and Navigation, Web Parts.

Follow comments via the RSS Feed | Leave a comment | Trackback URL

Comments on "How To Extend Wildcard People Search on MOSS 2007": 5 Comments

  1. Links (1/24/2008) « Steve Pietrek’s SharePoint Stuff wrote,

    [...] How To Extend Wildcard People Search on MOSS 2007 [...]

  2. YASB - Share(Point) your Knowledge » Extend Wildcard People Search wrote,

    [...] just drag&drop a content editor web part to your portal and copy&paste this code from this sharepointbuzz.com posting, in it. That’s all. Its based on a code sample of Ramon [...]

  3. Employee Directory using User Information List in SharePoint 2007 « SharePoint Sherpa wrote,

    [...] How to Extend Wildcard People Search on MOSS 2007 [...]

  4. SharePoint 2007 How To List « SharePoint Sherpa wrote,

    [...] Extend Wildcard People Search [...]

  5. enable javascript ie7 wrote,

    [...] not support Javascript. I really like technology and also chasing up on the …www.geekzone.co.nzHow To Extend Wildcard People Search on MOSS 2007 Ramon Scott just posted on his blog on how to perform wildcard people search on MOSS 2007.? His [...]

Leave Your Comment

You must be logged in to post a comment.