My additions

Mar 13, 2009 at 9:52 PM
In order to ensure items inside of subfolders also show up I added recursive scope to the view attributes for each of the SPQuery()s:

query1.ViewAttributes = "Scope=\"Recursive\"";

And also to improve performance with very large lists I added a RowLimit of 1000 since getting back a list of more than 1000 to choose from would sort of negate the usefulness of searching with the picker:

query1.RowLimit = 1000;

Lastly this should be deployed via a Solution Package, not with scripts. Here is a sample manifest to use:
<?xml version="1.0" encoding="utf-8" ?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
          SolutionId="GUID HERE">
  <Assemblies>
    <Assembly Location="MyDLL.dll"
                  DeploymentTarget="GlobalAssemblyCache">
      <SafeControls>
        <SafeControl Namespace="MyNamespace.LookupWithPicker" Safe="True" TypeName="*" />
      </SafeControls>
    </Assembly>
  </Assemblies>
  <RootFiles>
    <RootFile Location="TEMPLATE\XML\fldtypes_LookupWithPicker.xml" />
    <RootFile Location="TEMPLATE\CONTROLTEMPLATES\ControlTemplates_LookupWithPicker.ascx" />
    <RootFile Location="TEMPLATE\CONTROLTEMPLATES\LookupWithPicker.ascx"/>
  </RootFiles>
</Solution>


http://sharepointdevsolutions.blogspot.com/