Share via


SPUserCollection.GetByEmail Method

Returns the user with the specified e-mail address.

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

Syntax

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

returnValue = instance.GetByEmail(emailAddress)
[ClientCallableExceptionConstraintAttribute(FixedId = "System.UnauthorizedAccessException$-2147024891", 
    ErrorType = typeof(UnauthorizedAccessException), Condition = "Access is denied.")]
[ClientCallableMethodAttribute(Name = "GetByEmail", ReturnObjectIdentity = true, 
    CacheReturnValue = true)]
[ClientCallableExceptionConstraintAttribute(FixedId = "Microsoft.SharePoint.SPException$-2146232832", 
    ErrorType = typeof(SPException), Condition = "User cannot be found.", 
    ErrorCode = )]
public SPUser GetByEmail(
    string emailAddress
)

Parameters

  • emailAddress
    Type: System.String

    A string that contains the e-mail address of the user.

Return Value

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

See Also

Reference

SPUserCollection Class

SPUserCollection Members

Microsoft.SharePoint Namespace