People Picker Searchcustomquery vs. Searchcustomfilter property

So I wanted to share an issue I recently had with the people picker which I have to admit was due to user error on my part but you may fall into the same trap!

So the trap I fell into was that I assumed the SharePoint staadm peoplepicker only had one configuration option for querying AD and this is where I went wrong!

So if you follow this TechNet guide for the people picker this is why I believe it isn't as clear as I thought! http://technet.microsoft.com/en-us/library/cc263318(v=office.12).aspx (appreciating this is for MOSS it was suggested this was still applicable to SharePoint 2010).

If you notice from the previous URL it suggests that there is only stsadm -o setproperty -pn peoplepicker-searchadcustomquery available for AD queries so I pursued this route to find very strange results appearing when searching for users. For example lets say I told my parameter only to return users where they have a phone number this command above returned anyone who had a phone number regardless of what you entered in the search term.

So after lots of head scratching I realised after taking a step back that rather than look at the parameters appended to the command I needed to look at the makeup of the command. On closer inspection I realised that there are 2 types of AD commands applicable to the people picker -pn peoplepicker-searchadcustomquery and -pn peoplepicker-searchadcustomfilter (The latter being the actual command I needed) from reading this further TechNet article which actually does the opposite to the previous article and does not mention the query command http://technet.microsoft.com/en-us/library/gg602075.aspx#section8.

Hopefully you can see how easily it was to be confused. So I after the light bulb moment I quickly changed the command and after hours of failure doubting the structure of the LDAP query I realised it was a simple mistake everything worked like a dream.

So to conclude on the commands:

Stsadm -o setproperty -pn peoplepicker-searchadcustomquery – THIS WILL SHOW RESULTS BASED UPON THE QUERY YOU PLACE HERE REGARDLESS OF THE VALUE ENTERED INTO THE PEOPLEPICKER

Stsadm -o setproperty -pn peoplepicker-searchadcustomfilter – THIS WILL SHOW RESULTS BASED UPON FILTERING A VALUE APPLICABLE.

I’m not entirely sure why you would use the customquery option so this is why I didnt wven give it a second thought this existed. If anyone has any scenario’s where this could be used I’d be interested to hear from you.

Further reading:

http://technet.microsoft.com/en-us/library/gg602068.aspx

Thanks to Tristan Watkins and Glyn Clough for their input and ideas on Twitter.

0 comments:

Post a comment