Monday, 12 October 2015

List all objects of Shared Project AX 2009/ 2012

Below code will info the list of objects in shared project in AX 2009/ 2012.

Static void ListALLObjectsFormProject(Args _args)
{
    ProjName        ProjName="Proj_Name";
    ProjectListNode        List = infolog.ProjectRootNode().AOTfindChild("Shared");
    TreeNodeIterator    ir = List.AOTiterator();
    ProjectNode        pnProj;
    ProjectNode        pn = List.AOTFindChild(ProjName);

    void searchAllObj(ProjectNode rootNode)
    {
        #TreeNodeSysNodeType
        TreeNode        ChildNode;
        TreeNodeIterator    rootNodeIterator;
        ;
        if(rootNode)
        {
            rootNodeIterator = rootNode.AOTiterator();
            childNode = rootNodeIterator.Next();
            while(childnode)
            {
       //for ax 2012 //if (childNode.treeNodeType().id() == #NT_PROJECT_GROUP)
                if(childNode.AOTgetNodeType() == #NT_PROJECT_GROUP)
                    searchAllObj(childNode);
                else
                    info(strfmt("%1 - %2",rootNode.AOTname(),childNode.AOTName()));

                childNode = rootNodeIterator.next();
            }
        }
    }
    ;
    if(pn)
    {
        info(strfmt("Project %1:",ProjName));
        pnProj = pn.LoadForInspection();
        searchAllObj(pnProj);
        pnProj.treeNodeRelease();
    }
    else
        info("Project Objects");

}


You can also create project of all customized objects by layers see link below
http://dextersdax.blogspot.in/2015/09/create-shared-project-for-customized.html