Share via


SPUserCollection.GetByID Method

Returns the user with the specified member ID.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<ClientCallableMethodAttribute(Name := "GetById")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "System.UnauthorizedAccessException$-2147024891",  _
    ErrorType := GetType(UnauthorizedAccessException), Condition := "Access is denied.")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "Microsoft.SharePoint.SPException$-2146232832",  _
    ErrorType := GetType(SPException), Condition := "User cannot be found.",  _
    ErrorCode := )> _
Public Function GetByID ( _
    id As Integer _
) As SPUser
'Usage
Dim instance As SPUserCollection
Dim id As Integer
Dim returnValue As SPUser

returnValue = instance.GetByID(id)
[ClientCallableMethodAttribute(Name = "GetById")]
[ClientCallableExceptionConstraintAttribute(FixedId = "System.UnauthorizedAccessException$-2147024891", 
    ErrorType = typeof(UnauthorizedAccessException), Condition = "Access is denied.")]
[ClientCallableExceptionConstraintAttribute(FixedId = "Microsoft.SharePoint.SPException$-2146232832", 
    ErrorType = typeof(SPException), Condition = "User cannot be found.", 
    ErrorCode = )]
public SPUser GetByID(
    int id
)

Parameters

  • id
    Type: System.Int32

    A 32-bit integer that specifies the member ID.

Return Value

Type: Microsoft.SharePoint.SPUser
A Microsoft.SharePoint.SPUser object that represents the user.

Remarks

The value of the id parameter corresponds to the unique member ID for the user, which is contained in the ID property of the SPMember class.

See Also

Reference

SPUserCollection Class

SPUserCollection Members

Microsoft.SharePoint Namespace