Delete a Role

Private Sub DeleteRole()
On Error GoTo errHandler

'Get the role container in order to do any database update operation

'An time expensive operation, ideally, a global variable is more suited

Dim objRoleContainer As IRoleContainer

Set objRoleContainer = g_objNameSpace.GetRoleContainer

'Get the "UserCreationManager" role from the role container

Dim objRole As Role

Set objRole = objRoleContainer.GetRolesOnNames("UserCreationManager")

'Tell the rolecontainer to delete the role

objRoleContainer.RemoveRole objRole.Guid

Exit Sub


  MsgBox "Error deleteing UserCreationManager Role" & " Error no: " & Err.Number & " ErrorDescription: " & Err.Description

End Sub


See Also