Users and groups in SharePoint can be added to the site. put a keyword to search for users in the domain. After confirmation, the user displays the user's display name, which is underlined. how does people picker work?
1. People will query SharePoint's content database by running an SQL statement:
Exec sp_executesql
N'
Select top 202 T1. [type] As C0,
T1. [metainfo] as C2,
Userdata. [nvarchar3],
Userdata. [tp_contenttypeid],
Userdata. [nvarchar8],
Userdata. [tp_id],
Userdata. [tp_copysource],
Userdata. [tp_version],
Userdata. [nvarchar4],
T1. [scopeid] as C4,
Userdata. [nvarchar9],
Userdata. [nvarchar5],
Userdata. [tp_created],
Case
When datalength (t1.dirname) = 0 then t1.leafname
When datalength (t1.leafname) = 0 then t1.dirname
Else t1.dirname + N''/''+ T1.leafname
End as C1,
Userdata. [tp_hascopydestinations],
Userdata. [nvarchar1],
Userdata. [tp_moderationstatus],
Userdata. [tp_level],
T1. [ID] as C3,
Userdata. [tp_contenttype]
From userdata
Inner merge join Docs as T1 with (nolock)
On (1 = 1
And userdata. [tp_rowordinal] = 0
And t1.siteid = userdata. tp_siteid
And t1.siteid = @ L2
And t1.dirname = userdata. tp_dirname
And t1.leafname = userdata. tp_leafname
And t1.level = userdata. tp_level
And t1.iscurrentversion = 1
And (1 = 1 ))
Where (userdata. tp_iscurrent = 1)
And userdata. tp_siteid = @ L2
And (userdata. tp_dirname = @ DN)
And userdata. tp_rowordinal = 0
And (userdata. [bit3] = 0)
And (userdata. [nvarchar3] Like @ l3txp)
Or (userdata. [nvarchar1] Like @ l4txp ))
Or (userdata. [nvarchar4] Like @ l4txp ))
And t1.siteid = @ L2
And (t1.dirname = @ DN ))
Order by T1. [type] DESC,
Userdata. [nvarchar3] ASC,
Userdata. [tp_id] ASC
Option (Force Order)
,
N'@ L0 uniqueidentifier, @ L2 uniqueidentifier, @ l3txp nvarchar (255), @ l4txp nvarchar (255), @ nvdn archar (260)',
@ L0 ='00000000-0000-0000-0000-000000000000',
@ L2 ='48d3167b-xxxx-xxxx-xxxx-ee6030973575',
@ L3txp = N'% Keyword %',
@ L4txp = N'Keyword %',
@ DN = N'_ Catalogs/users'
Note that the l3xp contains wildcards before and after the input keyword. The nvarchar3 stores Login Name, therefore, if the keywords you enter is any part of the login name, you can obtain the search result from the content database.
L4xp only includes a wildcard after the keyword. Therefore, the keyword you search for must be the start part of the field in nvarchar1 or nvarchar4. It is inferred based on the content, the two fields are displayname and email address.
2. if the user is not found in the content database, it indicates that the user has not been added to the site before. People picker then queries the domain controller, runs the LDAP query, and obtains the user instance returned by the ad.
3. If Network Monitor is used to capture the Network Package and use LDAP protocol as the filter, you will see the LDAP query filter, the attribute list to AD, and the attribute list returned by AD.