Exporting Project Definitions

I concocted the following bit of code to automate the task of exporting project definitions to XPO files. It is a simple bit of code that allows the user to dump the project definition files to a specified folder.

Create a new job in the AOT, then paste in the following code. Set the output folder to the desired target and run the job.

static void ExportProjectDefinitions(Args _args)
{
    TreeNode        node;
    ProjectNode     project;
    str             path, folder = "C:\\Temp\\Projects\\";
;
    project = SysTreeNode::getSharedProject().AOTfirstChild();
    while(project)
    {
        node = project.loadForInspection();
        path = strfmt("%1%2_%3.xpo"
		,folder
		,enum2str(node.applObjectType())
		,node.treeNodeName());
        node.treeNodeExport(path, 2049);
        project = project.AOTnextSibling();
    }
    info("Complete");
}

Enjoy!

Share/Bookmark
This entry was posted in AX 2009, AX 2012, AX 4.0, Microsoft Dynamics AX and tagged , , , , . Bookmark the permalink.