Greetings,
I am trying to list all pages in the space/page and put them into the table with their current version and last comment.
I've google a bit and figured out it shoud be something like this... However the array of listpages seems to be empty.
What am I doing wrong?
## @param Page:title=Page|option-showTitleInPlaceholder=true|type=confluence-content|desc=Target page
#if ($paramPage.contains(':'))
#set ( $strArray = [] )
#foreach($str in $paramPage.split(':'))
#set($dummy = $strArray.add($str)) ## Assign returnval to avoid printing 'true'.
#end
#set($spacekey = $strArray.get(0).trim())
#set($pagetitle = $strArray.get(1).trim())
#else
#set($spacekey = $content.getSpaceKey()) ## Current spacekey
#set($pagetitle = $paramPage.trim())
#end
#set($containerManagerClass=$content.class.forName('com.atlassian.spring.container.ContainerManager'))
#set($getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null))
#set($containerManager=$getInstanceMethod.invoke(null,null))
#set($containerContext=$containerManager.containerContext)
#set($pageManager=$containerContext.getComponent('pageManager'))
#set ($listpages=$pageManager.getPages($spacekey, $pagetitle))
<table>
<tr>
<th>Page Name</th>
<th>Current Version</th>
<th>Change Comment</th>
</tr>
#foreach($listpage in $listpages)
<tr>
<td>X $listpage.getTitle()</td>
<td>Y $listpage.version</td>
<td>Z $listpage.getVersionComment</td>
</tr>
#end
</table>