Partilhar via


SPRole.AddUser Method (String, String, String, String)

NOTE: This API is now obsolete.

Use the new SPRoleDefinition and SPRoleAssignment classes instead, to define roles and to assign users to them. For more information, see Authorization Object Model. (In Windows SharePoint Services 2.0, the AddUser method added the user specified by user name, e-mail address, display name, and notes to the role and is maintained for backward compatibility.)

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<ObsoleteAttribute("Use the SPRoleDefinition class instead")> _
Public Sub AddUser ( _
    loginName As String, _
    email As String, _
    name As String, _
    notes As String _
)
'Usage
Dim instance As SPRole
Dim loginName As String
Dim email As String
Dim name As String
Dim notes As String

instance.AddUser(loginName, email, name, _
    notes)
[ObsoleteAttribute("Use the SPRoleDefinition class instead")]
public void AddUser(
    string loginName,
    string email,
    string name,
    string notes
)

Parameters

  • loginName
    Type: System.String

    A string that contains the user name (DOMAIN\User_Alias).

See Also

Reference

SPRole Class

SPRole Members

AddUser Overload

Microsoft.SharePoint Namespace