Add the Authors Role to a Custom View Example

This example uses the Cognos namespace to add the Authors role to a Custom View.
Sub Example15()
    Dim objTransApp As Object
    Dim model As Model
    Dim new_namespace As TransformerSDKLib.Namespace
    Dim securityObject As SecurityObject
    Dim customView As CustomView
    Dim CAMID_of_Namespace As String
    Dim CAMID_of_User As String
    Dim CAMID_of_Object As String
    Dim Name_of_Namespace As String
    Dim Name_of_User As String
    Dim Name_of_Object As String
    Dim ID_of_Namespace As String
    Dim strIBMCognos10Location As String
    Dim strModelPath As String
    Dim strModelSource As String
    'Change these paths to match your installation
    strIBMCognos10Location = "C:\Program Files\IBM\Cognos\c10\"
    strModelSource = "great outdoors sales.mdl"
    strModelPath = strIBMCognos10Location & _
        "webcontent\samples\models\Transformer8\EN\" & strModelSource
    Name_of_Namespace = "Cognos"
    ID_of_Namespace = ""
    Name_of_User = ""
    Name_of_Object = "Authors"
    objTransApp = CreateObject("IBMCognosTransformer.ApplicationCtrl.1")
    With objTransApp
        .DataSourcePath = strIBMCognos10Location &
"bin"
        .TransdaPath = strIBMCognos10Location & "CS7Gateways\bin\TransDa.exe"
    End With
    model = objTransApp.OpenModel(strModelPath)
    'Provide namespace, username, and password in that order
    objTransApp.Logon("Cognos", "", "") 'Log into the Cognos namespace
using Anonymous user
    new_namespace = model.Namespaces.Add()
    'Provide: Namespace and Object names
    'Receive: Both Namespace's and Object's CAMIDs
    With new_namespace
        .Name = Name_of_Namespace
        .ObjectName = Name_of_Object 'Authors is a group
        .Update()
        CAMID_of_Namespace = .CAMID
        CAMID_of_Object = .ObjectCAMID
        CAMID_of_User = ""
    End With
    'Another way to get CAMIDs below (Commented Out) 
    'The code below can be adapted to use any Namespace and User
    'Provide: Namespace ID and user
    'Receive: Namespace and User CAMIDs and Namespace name
    'With new_namespace
    '    .ID = ID_of_Namespace
    '    .User = Name_of_User
    '    .Update()
    '    CAMID_of_Namespace = .CAMID
    '    CAMID_of_User = .UserCAMID
    '    Name_of_Namespace = .Name
    'End With
    'Create custom view
    customView = model.CustomViews.Add()
    With customView
        .Name = Name_of_Object
        .Update()
    End With
    'Create and add security object to custom view
    securityObject = new_namespace.SecurityObjects.Add()
    With securityObject
        .Name = CAMID_of_Object 'provide the User or Object CAMID
here
        .DisplayName = Name_of_Object
        .Type = xtrSecurityType.trSecurityType_Role
        .AddToCustomView(customView)
        .Update()
    End With
    With model
        .SaveAs("great outdoors salesX.mdl")
        .Close()
    End With
    objTransApp.Logoff()
    objTransApp = Nothing
End Sub