SPWeb.EnsureUser 方法

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.

命名空间:  Microsoft.SharePoint
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
Public Function EnsureUser ( _
    logonName As String _
) As SPUser
用法
Dim instance As SPWeb
Dim logonName As String
Dim returnValue As SPUser

returnValue = instance.EnsureUser(logonName)
public SPUser EnsureUser(
    string logonName
)

参数

  • logonName
    类型:System.String

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

返回值

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

异常

异常 条件
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.

另请参阅

引用

SPWeb 类

SPWeb 成员

Microsoft.SharePoint 命名空间