Click or drag to resize

IRoleDelete Method

Delete the role. Marks the role as deleted and removes all data and function rights from the role. Users having the deleted role must be assigned a new role. Will throw an error if you do not have user admin rights.

Namespace:  SuperOffice.COM.SuperOfficeDB
Assembly:  SuperOfficeDB.Interop (in SuperOfficeDB.Interop.dll) Version: 8.0.0.0
Syntax
void Delete()
Examples

[New Example]

This text may be copied to the notepad, and saved as a *.vbs file. Remember to change the login information.

This will create a role, add a functionright, give a message if successfull and delete the role again.

VB
'This is written to run from a CRM SIX programfolder

enRoleTypeEmployee = 0

Dim db
Set db = CreateObject("superofficedb.Database")
If db.Login("<username>", "<password>") Then
    set role = db.Admin.CreateRole(enRoleTypeEmployee, Nothing)
    role.Name = "deleterole"
    role.Description = "this is a new role with name deleterole"
    role.Save()

    set allrights = db.Admin.GetAllFunctionRights(enRoleTypeEmployee)
    set fr = allrights(3)
    role.AddFunctionRight(fr)

    role.Save()

    For Each item In role.FunctionRights
        MsgBox(item.Text)
    Next

    role.Delete()

    If db.Admin.GetRoles(enRoleTypeEmployee).Exists(role.Identity) Then
    MsgBox("Role is not deleted")
    End If

    If role.FunctionRights.Exists(3) Then
    MsgBox("FunctionRight is not deleted")
    End If
Else
    MsgBox("failed to log in")
End If

See Also