Export (0) Print
Expand All
Expand Minimize
0 out of 5 rated this helpful - Rate this topic

SPWeb.EnsureUser method

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)
[ClientCallableMethodAttribute(Name = "EnsureUser", CacheReturnValue = false)]
public SPUser EnsureUser(
	string logonName


Type: System.String

The logon name (Domain\User_Alias) of the user.

Return value

Type: Microsoft.SharePoint.SPUser
A user with the specified logon name.

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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.