For retreiving the list of projects we cannot use Treenode. We should first use infolog.projectrootnode() to get the root node for projects and then proceed with the treenode iterator to get the list of the rest. Below is the code that will display the list of Private and Shared Projects from the project node.
static void GetProjects(Args _args)
{
ProjectListNode projectListNode;
treenodeIterator iterator,projectiterator;
TreeNode treenodeprivate,treenodeprivateprojects,treenodeShared,treenodesharedprojects;
int i;
;
projectListNode = infolog.projectRootNode();
treenodeprivate = projectListNode.AOTfirstChild();
iterator =treenodeprivate.AOTiterator();
setprefix("Private projects");
for(i = 1; i<=treenodeprivate.AOTchildNodeCount();i++)
{
treenodeprivateprojects = iterator.next();
info(findproperty(treenodeprivateprojects.AOTgetProperties(),"Name"));
}
treenodeshared = infolog.projectRootNode().AOTfindChild('Shared');
projectiterator = treenodeshared.AOTiterator();
setprefix("Shared Projects");
for(i=1; i<= treenodeshared.AOTchildNodeCount();i++)
{
treenodesharedprojects = projectiterator.next();
info(findproperty(treenodesharedprojects.AOTgetProperties(),"Name"));
}
}
Attached is the Output of the following Job:
No comments:
Post a Comment