Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Checks whether the specified logon name belongs to a valid user of the website, and if the logon name does not already exist, adds it to the website.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
'Declaration
Public Function EnsureUser ( _
logonName As String _
) As SPUser
'Usage
Dim instance As SPWeb
Dim logonName As String
Dim returnValue As SPUser
returnValue = instance.EnsureUser(logonName)
public SPUser EnsureUser(
string logonName
)
logonName
Type: System.String
The logon name (Domain\User_Alias) of the user.
Type: Microsoft.SharePoint.SPUser
A user with the specified logon name.
Exception | Condition |
---|---|
SPException | The user with the specified logonName cannot be found in Active Directory. |
The current user must have the BrowseUserInfo rights to view the users of the website.
Please sign in to use this experience.
Sign in