Click or drag to resize

IRoleDeleted Property

Has the role been deleted?

Namespace:  SuperOffice.COM.SuperOfficeDB
Assembly:  SuperOfficeDB.Interop (in SuperOfficeDB.Interop.dll) Version: 8.0.0.0
Syntax
bool Deleted { get; }

Property Value

Type: Boolean
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

Deleted

VB
Dim objDB
Dim msg

Set objDB = CreateObject("superofficedb.database")
If Not (objDB is Nothing) Then
    objDB.login "<userid>", "<password>" ' log in to the database

    Set myRoles = objDB.Admin.GetRoles(enRoleTypeEmployee)
    If Not myRoles.Empty Then
        For Each item In myRoles
            msg = msg & "Name :" & item.Name & vbCrLf
            msg = msg & "Description :" & item.Description & vbCrLf
            msg = msg & "Dataright contact-to group:" & item.DataRight(enTableCont, enRelToGroup) & vbCrLf
            msg = msg & "Deleted :" & item.Deleted & vbCrLf
            msg = msg & "Functionrights :" & item.FunctionRights.Count & vbCrLf
            msg = msg & "Identity :" & item.Identity & vbCrLf
            msg = msg & "Type :" & item.Type & vbCrLf
            msg = msg & "_________________________________________________" & vbCrLf
        Next
        MsgBox "There are " & myRoles.Count & " roles: " & vbCrLf & msg

    End If

Else
    MsgBox "unable to connect to database"
End If
Set objso = Nothing

See Also