Import projects from the command line

You can use the Windows command line interface to import projects in XER format, which also enables you to do so from a batch file or programmatically.

To use the Windows command line interface to import an XER file, do the following:

  1. Using an XML editor, or any program that can save files as XML files, create an actions.xml file that specifies the EPS you want to import the project to, the layout you want to use, and the XER file you want to import from.

    You can specify more than one import action in a single file by including multiple <action> nodes.

    The following is a sample actions.xml file that imports 2 XER files from the same script. All tags must appear in the file; however, you can leave some tags empty, as noted below. Values in bold are literal values you must enter as is. Values in italics are samples that will vary with your configuration.

    <actions>

    <action>

    <type>import</type>

    <importFormat>XER</importFormat>

    <importType>PROJECT</importType>

    <importAction>CREATE</importAction>

    <importTo>EPS1</importTo>

    <importConfiguration>MyConfig1</importConfiguration>

    <importFile>c:\somefile1.xer</importFile>

    </action>

    <action>

    <type>import</type>

    <importFormat>XER</importFormat>

    <importType>PROJECT</importType>

    <importAction>CREATE</importAction>

    <importTo>EPS2</importTo>

    <importConfiguration>MyConfig2</importConfiguration>

    <importFile>c:\somefile2.xer</importFile>

    </action>

    </actions>

    Tag

    Description

    <type>

    Required. The type of action to take. For project importing, type is import. Note that import is case sensitive.

    <importFormat>

    Required. The format being imported. Value must be XER.

    <importType>

    Required. The type data being imported. Value must be PROJECT.

    <importAction>

    Required. The action to take while importing. Value must be CREATE.

    <importTo>

    Optional. The short name of the EPS element you are importing to. This name must exist in the destination database. If you do not provide a name, the default EPS is used.

    <importConfiguration>

    Optional. The import configuration to use while importing. This name must exist in the destination database. If you do not provide a name, the default import configuration used.

    <importFile>

    Required. The full path to the XER file you want to import.

    Note:

    If you include non-English characters in the actions.xml file, save the file as Unicode and use the XML encoding attribute to specify the language, prior to the <actions> tag. For example, to specify German or French encoding:

    <?xml version="1.0" encoding="windows-1252"?>

    If you are using a batch file, use the chcp command to specify the appropriate language encoding. See Microsoft.com for more internationalization details.

  2. Close P6 Professional if it is running.
  3. On the Windows command line, a batch file, or code, issue a command in the following form from the folder where PM.EXE is located:

    PM.EXE /username=<name>

    [/password=<name>]

    [/alias=<name>] /actionScript=<path>

    [/logfile=<path>]

    Parameter

    Description

    /username=<name>

    Required. The username to log in to P6 Professional.

    /password=<name>

    The password for the username, if there is one for the username.

    /alias=<name>

    Optional. The name of an existing destination database alias. If you do not specify an alias, the most recently accessed alias is used.

    /actionScript=<path>

    The full path to the actions.xml file you created. You must include the file name.

    /logfile=<path>

    Optional. The full path for creating the log file that contains processing results. You must include the file name. If the logfile is not set, the default log file destination is PrimaveraCmdLineLog.txt in the PM.exe application folder.

For example:

PM.EXE /username=admin /password=admin /alias=PMDB /actionScript=c:\somefolder\importprojects.xml/logfile=c:\somefolder\myLog.txt

If any values include spaces, enclose the value in double quotes("). For example:

PM.EXE /username=admin /password=admin /alias=PMDB /actionScript="c:\somefolder\importprojects.xml" /logfile="c:\somefolder\myLog.txt"

If the import runs successfully, then an exit code of 0 is returned; if any errors are logged to the log file, an exit code greater than 0 is issued, which indicates failure.

Processing results are written to the log file, or you can echo them to the command line interface. These are the possible results:

Code

Description

0

Success.

1

Invalid alias.

2

Invalid username or password.

3

XML file not found.

4

Invalid action type (you did not specify CREATE).

5

Insufficient security privileges.

6

Failure while processing the import action. Could include invalid or missing values in the xml file.

214783647

Unhandled exception, including invalid characters.

If the command does not include all the required parameters, P6 Professional opens.

Notes



Legal Notices
Copyright © 1999, 2016, Oracle and/or its affiliates. All rights reserved.

Last Published Wednesday, May 25, 2016