User Macro: List all pages by the lable and manipulate them

Vladimir Vakhlov August 8, 2020

Greetings,


In my user macro I am trying to list all pages through my confluence for defined label and then manipulate them (for example, sort by name). 

I was searching through pageManager, but was not able to find what method can do it. Any ideas?

Thanks!

1 answer

1 vote
Dominic Lagger
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 21, 2020

Hi @Vladimir Vakhlov 

Here is an user macro which shows 10 pages of the label "test".

You get an list of ContentEntityObjects. You can try to sort the list.

#set( $label = $action.getLabelManager())
#set( $pageList = $label.getContentForLabel(0,10,$label.getLabel("test")).getList())


<table>
<tr>
<th>Name</th>
<th>Bearbeiter</th>
</tr>
#foreach( $page in $pageList )
<tr>
<td>$page.getDisplayTitle()</td>
<td>$page.getLastModifierName()</td>
</tr>
#end
</table>

Hope this helps you

Regards, Dominic

Vladimir Vakhlov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 9, 2021

Thanks @Dominic Lagger !

Like Dominic Lagger likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events