Friday, 17 October 2014

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



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();

}

No comments:

Post a Comment