Skip to main content

X++ Code to Export AOT Object / automatic backup of XPO's.


Hi friends, hope all is well!! J

Today am here to convey the most vital subject for MS dynamics AX.

Development or customization's are the most important topic which should be saved or backup need to be taken on daily or weekly basis.

We need to take daily backup of our development (in terms of XPO), but we all always forget because of our hectic work schedules.

So use the following job and build batch application to take backup of development in terms of XPO.
We can take AOD file also but the size will be more and needs to stop AOS every time.

Following job illustrates how to export/backup all AOT Classes object.

void ExportTreeNodeExample()
{
    TreeNode            treeNode;
    FileIoPermission    perm;

    #define.ExportFile(@"D:\AOTclasses.xpo")
    #define.ExportMode("w")
    ;

    perm = new FileIoPermission(#ExportFile, #ExportMode);
    if (perm == null)
    {
    return;
    }
    perm.assert();

    treeNode = TreeNode::findNode(@"\Classes");
    if (treeNode != null)
    {

    // BP deviation documented.
    treeNode.treeNodeExport(#ExportFile);
    }

    CodeAccessPermission::revertAssert();

}

Keep reading!! J

Comments

  1. Check this file
    https://www.box.com/s/khmpb1u4x8ydt9sj7iie

    It's made for Dax 2012 . I export all xpos into a folder and search there after this

    ReplyDelete
    Replies
    1. hi adiso,
      Thanks for sharing the XPO related to DAX2012.

      Delete
  2. thanks, but how can I import object to AOT by code, please?

    ReplyDelete
    Replies
    1. Use standard class SysImportElements to get this. Just a simple example:

      SysImportElements sysImportElements = new SysImportElements();

      sysImportElements.newFile("D:\\testing.xpo");
      sysImportElements.parmImportAot(true);
      sysImportElements.parmImportWithIds(false);
      sysImportElements.import();

      Delete

Post a Comment