This documentation is archived and is not being maintained.

SPWeb.EnsureUser Method

Windows SharePoint Services 3

Checks whether the specified login name belongs to a valid user of the Web site, and if the login name does not already exist, adds it to the Web site.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public SPUser EnsureUser(
	string loginName
)

Parameters

loginName
Type: System.String
A string that contains the login name.

Return Value

Type: Microsoft.SharePoint.SPUser
An SPUser object that represents the user.
Show: