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.

Namespace:  [People Web service]
Web service reference: http://Site/_vti_bin/People.asmx

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/SearchPrincipals", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function SearchPrincipals ( _
    searchText As String, _
    maxResults As Integer, _
    principalType As SPPrincipalType _
) As PrincipalInfo()
'Usage
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("https://schemas.microsoft.com/sharepoint/soap/SearchPrincipals", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/", 
    ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public PrincipalInfo[] SearchPrincipals(
    string searchText,
    int maxResults,
    SPPrincipalType principalType
)

Parameters

  • maxResults
    Type: System.Int32

    Unless otherwise specified, the maximum number of principals that can be returned from a provider is 10.

Return Value

Type: []
A list of PrincipalInfo objects that is indexed and accessed by principal logon name.

Remarks

A user may have more than one type of authorization access within a Web site. A user may be part of a SharePoint Foundation 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

Reference

People Class

People Members

People Web Service

GetContextWeb(HttpContext)

ResolvePrincipals([], SPPrincipalType, Boolean)

SearchPrincipals()