Partilhar via


SPRole.Update Method

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 Update method updated the database with changes made 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 Update
'Usage
Dim instance As SPRole

instance.Update()
[ObsoleteAttribute("Use the SPRoleDefinition class instead")]
public void Update()

Examples

The following code example uses the Update method to change the name and description for a role.

Dim site As SPWeb = SPContext.Current.Web
Dim role As SPRole = site.Roles("Role_Name")

role.Description = "Description"
role.Name = "New_Name"

role.Update()
SPWeb oWebsite = SPContext.Current.Web;
SPRole oRole = oWebsite.Roles["Role_Name"];

oRole.Description = "Description";
oRole.Name = "New_Name";

oRole.Update();

See Also

Reference

SPRole Class

SPRole Members

Microsoft.SharePoint Namespace