1

I want Polarion API to get list of Projects and its associated Project Groups sothat we are trying to automate to get all groups

1 Answers1

2

The main entry point is $trackerService.projectsService.rootProjectGroup. It gives you the root of your project tree.

Here is a small script building a tree-view in HTML over all projectgroups and projects:

#macro(ListProjectGroup $projectGroup $nested)
  #foreach($pg in $projectGroup.getSortedContainedGroups())
    ${nested}* <a href="?project_group=$pg.location.locationPath&project="><img src="/polarion/ria/images/projectlist/project_group_closed.gif"/> $pg.name </a> 
    #ListProjectGroup($pg "$nested*")
  #end
  #foreach($p in $projectGroup.getSortedContainedProjects()) 
    ${nested}* <a target="_new" href="/polarion/#/project/$p.id/"><img src="/polarion/ria/images/projectlist/project_closed.gif"/> $p.name ($p.id) - *$!p.lead.name* </a>
  #end
#end

#set($_root_group = $trackerService.projectsService.rootProjectGroup.containedGroups.get(0))
#ListProjectGroup($_root_group "")
Peter Parker
  • 29,093
  • 5
  • 52
  • 80