ALM Site Administration API Type Library 12.50 and later
CreateProjectCopy2 Method
The logical group of projects in the ALM database.
The new project name.
If true, the project is a template.
The project type can be Standard, Template, or a project type created by an extension.

The type of database. Use the following constants or their values:

The domain of the existing project.
The name of the existing project.
The database server name.
The database administrator user name.
The database administrator password.
Storage on disk of Oracle database tables. If not Oracle, pass empty string ("").
Temporary storage location on disk for Oracle. If not Oracle, pass empty string ("").

Specifies flags that control project creation. Flags can be ORed together to specify multiply options.

Use the values from the SA_COPY_PROJECT_OPTIONS Enumeration.

One or more of the values:

Of the SA_COPY_PROJECT_OPTIONS Enumeration.

To specify both ACTIVATE and CREATE_VERSION_CONTROL, OR the options together:

(SA_ACTIVATE_NEW_PROJECT Or SA_CREATE_VERSION_CONTROL_DB)

Description
Creates a new project by copying some, or all, data and properties from an existing project.
Syntax
Visual Basic
Public Function CreateProjectCopy2( _
   ByVal DomainName As String, _
   ByVal NewProjectName As String, _
   ByVal IsTemplate As Boolean, _
   ByVal ProjectType As String, _
   ByVal NewDbType As Integer, _
   ByVal SourceDomainName As String, _
   ByVal SourceProjectName As String, _
   ByVal DbServerName As String, _
   ByVal AdminUser As String, _
   ByVal AdminPassword As String, _
   ByVal TableSpace As String, _
   ByVal TempTableSpace As String, _
   ByVal CopyOptions As Long, _
   ByVal CreationOptions As Long _
) As String
Parameters
DomainName
The logical group of projects in the ALM database.
NewProjectName
The new project name.
IsTemplate
If true, the project is a template.
ProjectType
The project type can be Standard, Template, or a project type created by an extension.
NewDbType

The type of database. Use the following constants or their values:

  • SA_MSSQL_DB_TYPE (value: 2)
  • SA_ORACLE_DB_TYPE (value: 3).
SourceDomainName
The domain of the existing project.
SourceProjectName
The name of the existing project.
DbServerName
The database server name.
AdminUser
The database administrator user name.
AdminPassword
The database administrator password.
TableSpace
Storage on disk of Oracle database tables. If not Oracle, pass empty string ("").
TempTableSpace
Temporary storage location on disk for Oracle. If not Oracle, pass empty string ("").
CopyOptions

Specifies flags that control project creation. Flags can be ORed together to specify multiply options.

Use the values from the SA_COPY_PROJECT_OPTIONS Enumeration.

CreationOptions

One or more of the values:

  • SA_PROJECT_CREATION_NONE
  • SA_ACTIVATE_NEW_PROJECT
  • SA_CREATE_VERSION_CONTROL_DB

Of the SA_COPY_PROJECT_OPTIONS Enumeration.

To specify both ACTIVATE and CREATE_VERSION_CONTROL, OR the options together:

(SA_ACTIVATE_NEW_PROJECT Or SA_CREATE_VERSION_CONTROL_DB)

Return Type

On success, returns an XML string containing the project properties.

Remarks
The source project must be deactivated before this function is called.
Return Value Details

The properties of the XML return string:

Example
Private Sub CreateProjectCopy2() 
'The following Visual Basic example creates a new project 
' in an existing domain by copying the customization 
' requirements and users from an existing project. 
    Dim sDomainName As String 
    Dim sNewProjectName As String 
    Dim sProjectName As String 
                Dim sProjectType As String 
    Dim sServerName As String 
    Dim CreateOptions As Long 
    Dim CopyOptions As Long 
    Dim sReply As String 
    On Error GoTo err 
    sDomainName = "MyNewDomain" 
    sNewProjectName = "MyBrandNewProject" 
    sProjectName = "MyNewProject" 
                sProjectType = "Standard" 
    sServerName = "http://myserver/qcbin" 
'Disconnect all users from Project 
    Call m_SAClient.DisconnectProject _ 
        (sDomainName, sProjectName) 
' Deactivate source project 
    Call m_SAClient.DeactivateProject _ 
        (sDomainName, sProjectName) 
' Copy from source project to new project 
    CreateOptions = SA_ACTIVATE_NEW_PROJECT 
    CopyOptions = SA_COPY_PROJECT_CUSTOMIZATION _ 
        + SA_COPY_PROJECT_REQUIREMENTS _ 
        + SA_COPY_PROJECT_USERS_AND_GROUPS 
        
    sReply = m_SAClient.CreateProjectCopy2 _ 
        (sDomainName, sNewProjectName, False, sProjectType, SA_ORACLE_DB_TYPE, _ 
        sDomainName, sProjectName, _ 
        sServerName, "admin", "swordfish", _ 
        "", "", _ 
        CopyOptions, CreateOptions) 
    
' Reactivate source project 
    Call m_SAClient.ActivateProject _ 
        (sDomainName, sProjectName) 
    MsgBox sReply 
    Exit Sub 
err: 
    MsgBox "Program failed:" + err.Description 
End Sub 
See Also

SAapi Object  | SAapi Members