SPWeb.AddApplicationPrincipal 方法

Adds a user to the website as an application principal; that is, a user object that is delegated to act on behalf of an external application.

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

语法

声明
Public Function AddApplicationPrincipal ( _
    logonName As String, _
    allowBrowseUserInfo As Boolean, _
    requireRequestToken As Boolean _
) As SPUser
用法
Dim instance As SPWeb
Dim logonName As String
Dim allowBrowseUserInfo As Boolean
Dim requireRequestToken As Boolean
Dim returnValue As SPUser

returnValue = instance.AddApplicationPrincipal(logonName, _
    allowBrowseUserInfo, requireRequestToken)
public SPUser AddApplicationPrincipal(
    string logonName,
    bool allowBrowseUserInfo,
    bool requireRequestToken
)

参数

  • logonName
    类型:System.String

    The Active Directory logon name of the user.

  • allowBrowseUserInfo
    类型:System.Boolean

    true to allow the new application principal user to access information about the website users; otherwise, false.

  • requireRequestToken
    类型:System.Boolean

    true to require that the new application principal user has a request token; otherwise, false.

返回值

类型:Microsoft.SharePoint.SPUser
The application principal user.

异常

异常 条件
SPException

There is already a user on the website with the logon name logonName that is not an application principal.

ArgumentOutOfRangeException

No user with the specified logon name could be found in the Active Directory.

备注

This method can only run in the user context of a site collection administrator or in a call to RunWithElevatedPrivileges(SPSecurity.CodeToRunElevated).

When this method is called, the user must already exist in Active Directory, but must not exist as a user of the website with permissions, unless they are already an application principal.

另请参阅

引用

SPWeb 类

SPWeb 成员

Microsoft.SharePoint 命名空间