Stand with Ukraine 🇺🇦

Attachments in the Space Macro for Confluence

Attachments in the Space - Show all attachments from the current space in a sortable table view - Preview 2
Attachments in the Space - Show all attachments from the current space in a sortable table view - Preview 3
confluence-contentmedia

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.

Try for free

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>

Chosen by Top Global Companies Across Diverse Industries

BNP Paribas
Census
CNES
EDP
HHMI
HP
Hyundai
Index
Intercars
Melia
BNP Paribas
Census
CNES
EDP
HHMI
HP
Hyundai
Index
Intercars
Melia
Ministry
NVIDIA
PayPay
Pfizer
Qualcomm
Rail Canada
Red Cross
SEC
Space Institute
Telefonica
Ministry
NVIDIA
PayPay
Pfizer
Qualcomm
Rail Canada
Red Cross
SEC
Space Institute
Telefonica

Got Questions?

Fill out the form, and we'll guide you through every step of the way