People.SearchPrincipals Method

Returns an array of PrincipalInfo objects from the SPUserCollection for the Web site. All instances have the principal logon name specified in searchText. Only the maxResults objects can be added to the array.

Web Service: PeopleWeb Reference: http://<Site>/_vti_bin/People.asmx


<SoapDocumentMethodAttribute("", RequestNamespace:="", ResponseNamespace:="", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function SearchPrincipals ( _
    searchText As String, _
    maxResults As Integer, _
    principalType As SPPrincipalType _
) As PrincipalInfo()

Dim instance As People
Dim searchText As String
Dim maxResults As Integer
Dim principalType As SPPrincipalType
Dim returnValue As PrincipalInfo()

returnValue = instance.SearchPrincipals(searchText, maxResults, principalType)
[SoapDocumentMethodAttribute("", RequestNamespace="", ResponseNamespace="", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public PrincipalInfo[] SearchPrincipals (
    string searchText,
    int maxResults,
    SPPrincipalType principalType


  • searchText
    Principal logon name.
  • maxResults
    Unless otherwise specified, the maximum number of principals that can be returned from a provider is 10.
  • principalType
    SPPrincipalType object that specifies user scope and other information.

Return Value

A list of PrincipalInfo objects that is indexed and accessed by principal logon name.


A user may have more than one type of authorization access within a Web site. A user may be part of a Windows SharePoint Services group and a distribution list, in addition to having Web site access that is authorized by their logon name. Consequently, there may be multiple copies of the same user identifier (ID) that is associated with a specific Web site.

A subset of user information is compiled from provider sources and security scopes that are associated with a Web site. This subset of the SPUserCollection for the Web site is searched for all occurrences that contain the logon name specified in the searchText parameter that are of the specified principal type. If the logon name and principal pair is found within the subset, then the appropriate fields within the row are copied from the subset to the array that is returned to the calling module. If the login name and principal type pair does not exist within the subset of the SPUserCollection, it cannot be added to the array.

Only the maxResults rows can be returned to the calling module.

See Also


People Class
People Members
People Web Service
SPControl.GetContextWeb Method
People.ResolvePrincipals Method
SPUtility.SearchPrincipals Method