Monday, July 14, 2014

Getting a list of all projects

Question: How can i get a list of all projects in a system?

Answer: Use the code snippet below,

static void MSTA_Utility_ExportAllProjects(Args _args)
{
    #aot
    #properties
    #AviFiles
    SysOperationProgress    progressBar = new SysOperationProgress();

    TreeNode _treeNode;
    TreeNode projectNode;
    TreeNodeIterator iterator;
    int i, a;
    // Initialising progress bar
    progressBar.setCaption("Export To Excel in progress...");
    progressBar.setAnimation(#AviTransfer);

    _treeNode = infolog.projectRootNode();
    _treeNode = _treeNode.AOTfirstChild();

    for(i = 0; i < 2; i++)
    {
        iterator = _treeNode.AOTiterator();
        projectNode = iterator.next();
        while (projectNode)
        {
            progressBar.setText(strfmt("Project %1", projectNode.treeNodeName()));
            if(String::beginsWith(projectNode.treeNodeName(), "MSTA"))
            {
                info(projectNode.treeNodeName()) ;
            }
            projectNode = iterator.next();
            a++;
        }
        _treeNode = _treeNode.AOTnextSibling();
    }

}

2 comments:

  1. Thank you abdul, your posts will be very helpful for all starters in the sphere of software development. Currently I work at http://www.intellectsoft.net/ and if I have some interesting experience I'll share a link with you, as well.

    ReplyDelete
  2. Hello!
    Thanks for sharing this, the code snippet for getting the list of all projects will be quite useful for me, because I'm a beginner in this field and want to develop my skills and get some knowledge.

    ReplyDelete