Profiles.AddEx

This function adds a new Profile into the collection, and returns a new Profile object (with audit log explanation).

Syntax Parameters Return Value
Function Profiles.AddEx( _
    CreateInfo As ProfileCreateInfo) As Object
CreateInfo [in]

Information about the data configuration being added.

Type: ProfileCreateInfo

Object

SVB Example

Adding a data configuration:

Sub Main

    Dim oOM As ObjectManager

    'Reconnect into Enterprise ObjectManager
    Set oOM = New ObjectManager
    oOM.Reconnect Application

    Dim dataConfigInfo As New ProfileCreateInfo
    dataConfigInfo.ExternalProfile = True
    dataConfigInfo.Name = "Cats"
    dataConfigInfo.AuditLogReason = "Adding cat patient data configuration."
    'Connect this data configuration to the folder "Blake's Materials")
    dataConfigInfo.Folder = oOM.FindFolder("/Blake's Materials")

    'We will create configuration that points to external data
    Dim CatDataConfiguration As ExternalProfile
    Set CatDataConfiguration = oOM.Profiles.AddEx(dataConfigInfo)
    'Set the user permissions
    '("Everyone" will only have read access, "Administrators" and "Blake" can also edit it.)
    CatDataConfiguration.AutoSave = False
    CatDataConfiguration.AccessControlList.AddGroup("Administrators", True)
    CatDataConfiguration.AccessControlList.AddGroup("Everyone", False)
    CatDataConfiguration.AccessControlList.AddUser("Blake", True)
    'Connect it to the Database Connection "Cat Clinic"
    CatDataConfiguration.DataSource = oOM.ExternalDatabaseConnections.Item("Cat Clinic")
    'Add some queries to use
    CatDataConfiguration.Queries.Add("Everything", "SELECT * FROM ""Cat Clinic""", "")
    CatDataConfiguration.Queries.Add("Measurements", _
        "SELECT ""Patient ID"", ""Weight (1998)"", ""Body Length (1998)"", ""Weight (1999)"", ""Body Length (1999)"", ""Weight (2000)"", ""Body Length (2000)"" FROM ""Cat Clinic""", "")
    Dim configUpdateInfo As New ProfileUpdateInfo
    configUpdateInfo.AuditLogReason = "Setting up the permissions, adding queries."
    CatDataConfiguration.SaveEx(configUpdateInfo)

    oOM.Disconnect

End Sub