Quantcast
Channel: All Quality Center / ALM Practitioners Forum posts
Viewing all articles
Browse latest Browse all 14708

Re: Create Project and Link to a Template using SAClient api

$
0
0

Hi Shreyance,

 

You may need to write a code something like below for creating a specific project and linking it to a template.

 

For creating project refer to KB article KM183544.

 

Imports SACLIENTLib
Module Module1
    Sub Main()

        Dim sa As New SACLIENTLib.SAapi 'Instantiate saclient
        Dim serverName As String 'Name of the TD server
        Dim password As String 'Password for Site Admin
        Dim DomainName As String 'Domain of new project
        Dim ProjectName As String 'New project name
        Dim dbType As Long 'Database type
        Dim dbServerName As String 'Name of database server
        Dim AdminUser As String ' Name of database user ex. system
        Dim AdminPassword As String 'Password for database user
        Dim tablespace As String 'Oracle data tablespace
        Dim temptablespace As String 'Oracle temporary tablespace
        Dim tableSpaceSize As Long 'Oracle data tablespace size
        Dim tempTableSpaceSize As Long 'Oracle temp tablespace size
        Dim CreationOptions As Long 'Sum of options (activate, version control..)
        Dim response As String 'Returned information of function 
        Dim objSAClient

      
        objSAClient = CreateObject("SAClient.SaApi.9")
        objSAClient.login("http://SERVER_NAME:8080/qcbin", "USER_NAME", "USER_PASSWORD")
        Console.WriteLine("Connected to the Site Administration..")
        DomainName = "DEFAULT"
        ProjectName = "TD_Test"
		' INFORMATION FROM THE DB SERVERS TAB OF THE SITE ADMINISTRATION
        dbType = 2 'SA_MSSQL_DB_TYPE
        dbServerName = "" ' DB SERVER NAME
        AdminUser = "" ' DB SERVER USER NAME
        AdminPassword = "" ' DB SERVER PASSWORD
        tablespace = "" 'not needed for MS Access
        temptablespace = "" 'not needed for MS Access
        tableSpaceSize = 0 'not needed for MS Access
        tempTableSpaceSize = 0 'not needed for MS Access
        CreationOptions = 1 'Activate but do not enable version control
        'Create project
        'On Error Resume Next
        response = sa.CreateProject(DomainName, ProjectName, dbType, dbServerName, _
           AdminUser, AdminPassword, tablespace, temptablespace, tableSpaceSize, _
           tempTableSpaceSize, CreationOptions)
        'If Err() != '0' Then
        '    MsgBox(Err.Description)
        'End If

        'Job done
        'MsgBox("Finished!")
        Console.WriteLine("Project" + ProjectName + " is created in Domain Default successfully")
        'Show project properties
        'Text1.Text = response
        'Dim Project_Names As String

        objSAClient.LinkProjects("DEFAULT", "eApprove_V30119", "DEFAULT", ProjectName, "template")
        Console.WriteLine("Project" + ProjectName + " is linked to eApprove_V30119 template successfully")
        'Public Function LinkProjects( _
        'ByVal RemoteDomain As String, _
        'ByVal RemoteProject As String, _
        'ByVal LocalDomain As String, _
        'ByVal LocalProjects As String, _
        'ByVal LinkType As String _
        ') As String

        'RemoteDomain()
        'The domain of the project on the "from" side of the link. 
        'RemoteProject()
        'The name of the "from" project. This is typically a template project. 
        'LocalDomain()
        'The domain of the project or projects on the "to" side of the link. This is typically a project based on the template to which it is linked. 
        'LocalProjects()
        'A comma-separated list of project names. These project must all be in the specified domain. 
        'LinkType()
        'The role that the "from" project plays with respect to the "to" projects. For example, "template". 
        Console.ReadLine()
    End Sub
End Module

 Regards,

Srihari


Viewing all articles
Browse latest Browse all 14708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>