Attachments in the Space — Confluence Cloud Macro
This macro lists all attachments in the current Confluence space, displaying the filename, filetype, creation date, creator, and file size. It retrieves the data using a REST API call and formats it in a sortable AUI table.
User Parameters
This macro comes without configurable user parameters.
Template
#set( $query = "type=attachment and space='${space.key}'" )
#set( $expand = "extensions,version" )
#set( $url = "/wiki/rest/api/content/search?limit=250&expand=${expand}&cql=${query}")
#set( $attachments = $ConfluenceManager.get($url).results )
<table class="aui aui-table-sortable">
<thead>
<tr>
<th></th>
<th> Filename </th>
<th> Filetype </th>
<th> Created On </th>
<th> Created By </th>
<th> Size </th>
</tr>
</thead>
<tbody>
#foreach ( $att in $attachments )
<tr>
<td><a href="${baseUrl}${att._links.download}"><span class="aui-icon aui-icon-small aui-iconfont-download"></span></a></td>
<td>
<a href="${baseUrl}${att._links.webui}">$att.title</a>
</td>
<td> $att.extensions.mediaType </td>
<td> $att.version.friendlyWhen </td>
<td>
<a href="${baseUrl}/people/${att.version.by.accountId}"><span class="aui-lozenge">${att.version.by.publicName}</span></a>
</td>
#set ( $kb = $att.extensions.fileSize / 1024 )
<td> $kb kB </td>
</tr>
#end
</tbody>
</table>Recommended Macros
Displays a list of pages in specific space with certain title or label
Add a configurable floating panel to a Confluence page
Generate a list of labels from all spaces leading to corresponding content pages, organized in alphabetical order.
Parses a table containing cost and currency columns, converts each row's value into a selected result currency, and appends a footer row showing the total sum. Useful for tracking multi-currency expenses and reporting totals in a unified currency.
Macro for generating ID in base32 format
Content that is shown only if a user is in a particular group
Show an expandable page tree for a selected parent page (defaults to the current page)
Create dropdown menus in Confluence Cloud with predefined sets of options and permission gates