Export object to a file

Build 1501 on 14/Nov/2017  This topic last edited on: 11/Sep/2014, at 09:35

You can export a GN4 object (data) to a file. This can be useful if you want to see what's loaded in the database, and eventually to compare the database content with the last good backup of the data file.

Apply the export method, described in the following text, to the objects (publishing templates etc).

To export object from the database to a file

<cmd4path>\cmd4 export -name <itemname> -out <filepath> -srvurl http://<servername>/GN4/adminsrv.asmx -username <username> -password <password>

Notes

Replace <cmd4path> with the path of your GN4 application folder.

Replace <itemname> with the name of the item (without .xml extension).

Replace <filepath> with the full path to the file to be imported or exported, including file extension.

Replace <servername> with the real name of your GN4 server.

Replace <username> with the name of a GN4 user who has administrative permissions.

Replace <password> with the password of the <username> GN4 user.

Replace <fullpath> with the drive letter and the path to the file, including extension.

For a full list of command options see cmd4 export.

See also

Identifying the right import/export method

Example

This exports all the stories (STORY objects) in the Archive folder for the date range specified in the command line:

cmd4 export -out exp_Archive.xml -conditions SearchStory.xml -pars folderIds:4259482;begDate:2013-04-15;endDate:2013-04-21 -username xxxx -password yyyy

The SearchStory.XML is:

<SearchConditions 

         ObjectTypeName="story" 

         xmlns="http://www.teradp.com/schemas/GN4/1/SearchConditions.xsd" 

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <SearchNode xsi:type="SearchConditionList">

    <!--

      If a variable parameter is optional it can be omitted, and in such a case the corresponding

      condition is considered always true

    -->

    <List xsi:type="SearchCondition" Path="[story.publicationDate]" Op="Between">

      <From xsi:type="VariableSearchNode" Name="begDate" Type="String" Optional="false"/>

      <To xsi:type="VariableSearchNode" Name="endDate" Type="String" Optional="false"/>

   </List>

    <List xsi:type="SearchCondition" Path="[story.folderRef]" Op="In">

      <Ids xsi:type="VariableSearchNode" Name="folderIds" Type="IdList" Optional="false"/>

    </List>

  </SearchNode>

</SearchConditions>