I am attempting to programmatically duplicate the following steps in X++
- In the AOT Tree right click on the root node and click "Export"
- Provide a file name
- Click the "Application object layer" checkbox
- Specify "cus" as the Application object layer
- Export the XPO to the file
I've gotten as far as bring able to export entire AOT tree but I can't figure out a way to narrow it down to just the cus layer. Here is my current code sample ...
TreeNode treeNode;
FileIoPermission perm;
#define.ExportFile(@"c:\XPO\AOTCusExport.xpo")
#define.ExportMode("w")
;
perm = new FileIoPermission(#ExportFile, #ExportMode);
if (perm == null)
{
return;
}
perm.assert();
treeNode = TreeNode::findNode(@"\");
if (treeNode != null)
{
// BP deviation documented.
treeNode.treeNodeExport(#ExportFile);
}
CodeAccessPermission::revertAssert();
I have a feeling that the solution lies within the "treeNodeExport" method. There is an "int _flags" property that I am not using. I've looked around but I'm not sure what value to populate the flags with? Has anyone attempted this kind of process duplication before? Am I heading down the right path?