Create a project from items checked out with the version control

I regularly install a new build of AX, so I have to export and import the stuff I'm working on. I have written the following job to help me create a Private Project of whatever is checked out.

 static void SysCreatePendingObjectsProject(Args _args)
{
    Dialog                      dialog;
    DialogField                 dialogFieldProjectName;
    SysProjectFilterRunBase     upgradeProject;
    SysVersionControlTmpItem    item;
    TreeNode                    treeNode;
    UtilElements                utilElements;
    void createProject(SysElementName   _projectName)
    {
        ProjectNode upgradeNode;
        upgradeNode = SysTreeNode::createProject(_projectName);
        upgradeProject = new SysProjectFilterRunBase();
        upgradeProject.parmProjectNode(upgradeNode);
        upgradeProject.grouping(SysProjectGrouping::AOT);
    }
    void getCheckedOutItems()
    {
        item = versioncontrol.getCheckedOutItems();
    }
    void addItems()
    {
        while select item
            where item.ItemPath != ''
        {
            if (SysVersionControlTmpItem::isTreenode(item.InternalFilename))
            {
                treeNode  = TreeNode::findNode(item.ItemPath);
                utilElements = xUtilElements::findTreeNode(treeNode, false);
                upgradeProject.doUtilElements(utilElements);
            }
        }
    }    ;
    dialog = new Dialog();
    dialogFieldProjectName = dialog.addField(typeId(SysElementName));
    if (dialog.run())
    {
        createProject(dialogFieldProjectName.value());
        getCheckedOutItems();
        addItems();
        upgradeProject.write();
    }
}

There is one catch with this job though. It doesn't include the new elements I haven't "Created" yet, which is a bit of a problem if that is something you tend to forget. It's on my to-do list.

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm

Job_SysCreatePendingObjectsProject.xpo