You can use the Windows command line interface to export projects in XER format as a service.
Caution: Personal information (PI) may be at risk of exposure. Depending on local data protection laws organizations may be responsible for mitigating any risk of exposure.
To use the Windows command line interface to export projects as a service, do the following:
- Using an XML editor, or any program that can save files as XML files, create an actions.xml file that specifies the project or projects you want to export.
You can specify more than one action in a single file, by including multiple <action> nodes.
The following is a sample actions.xml file that drives the run of exporting one project. 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 shown. The other values are samples that will vary with your configuration.
<actions>
<action>
<type>export</type>
<Projects>
<ProjectID>Highway Project </ProjectID>
</Projects>
<outputFile>C:\HighwayProjectExport.xer</outputFile>
</action>
</actions>
Tag
Description
<type>
Required. The type of action to take. For project exporting, type is export. Note that export is case sensitive.
<Project ID>
Required. Specify one or more valid project IDs. (Do not enter an EPS ID.) You can specify multiple project IDs by specifying a list of projects separately, each with a separate tag on its own line, such as shown below:
<ProjectID>Highway Project </ProjectID>
<ProjectID>RSCD</ProjectID>
<outputFile>
Required. Must be set to a valid path and filename, for example, to C:\HighwayProjectExport.xer.
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.
- Close P6 Professional if it is running.
- On the Windows command line, a batch file, or code, issue a command in the following form from the folder where Primavera.CacheService.exe is located:
Primavera.CacheService.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>
Required. The full path to the edited actions.xml file. 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 Primavera.CacheService.exe application folder.
For example:
Primavera.CacheService.exe /username=admin
[/password=admin] [/alias=PMDB]
/actionScript=actions.xml
[/logfile=c:\myLog.txt]
If any values include spaces, enclose the value in double quotes(").
If the export 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 export). |
9 | Export action failure. |
214783647 | Unhandled exception, including invalid characters. |
If the command does not include all the required parameters, P6 Professional opens.
Notes
- If you export multiple projects in a single XER file, the interproject relationships between activities in the projects are preserved.
- When you export a project containing financial period performance data, only financial periods containing values for that project are exported. The module will not export all financial periods in the Financial Period dictionary.
When connected to a P6 Professional database: See Financial periods dialog.
- If you are exporting a project that you previously imported; and, that project contains relationships to external projects that do not exist in your database; and, you scheduled the project; be sure that you scheduled the project with the Ignore Relationships To and From Other Projects option selected (in the Schedule Options dialog box). If you select this option when scheduling the project, the module will preserve the external activity dates.
- When connected to a P6 EPPM database: No risk data is exported when using XER format. Risk Categories are part of global data and are exported when using XER format.