Substitute for Space-Attachment Macro?
Asked by Hans-Joachim Fritz:

I want to add a table to a Confluence page, which should contain an entry for all attachments below the current position, alike the Space-Attachment macro did.


Answers:
author: Barbara Szczesniak
body: [@Hans-Joachim Fritz](/t5/user/viewprofilepage/user-id/104256) I believe that this macro was removed in the Cloud version because the functionality is available by selecting **Space Settings \> Manage Content \> Attachments**.

Does this page meet your needs? Or do you need to display the information on an actual page in your space?

comments: author: Hans-Joachim Fritz
body: To be honest, yes, I need to have a table with all the confluence pages below the actual page and a table with all the attachments in the pages below.

But thanks very much, you solution s a workaround at least.


author: Roma Bubyakin
body: Hello [@Hans-Joachim Fritz](/t5/user/viewprofilepage/user-id/104256)

You might try our [User Macro for Confluence Cloud](https://marketplace.atlassian.com/apps/1232013/user-macro-for-confluence-cloud?hosting=cloud&tab=overview) app.

It gives full control over data that will be shown in macro. So any customization you need could be implemented there.

I have created a general macro for your use case that lists all attachments from the current space.  
It gives additional information which might be useful along with preview and download links.  

Here is how it looks like on the page:

![Shwo-all-attachments-from-space-in-macro.png](https://community.atlassian.com/t5/image/serverpage/image-id/315084i8C0854FB1C83E963/image-size/large?v=v2&px=999 "Shwo-all-attachments-from-space-in-macro.png")

And here is the code which could be altered to your needs as you wish:

```
#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>
```

As creators of the app, we can adjust macro to your needs.  
Additionally, the app is quite powerful and you can do many more things with it.

Let me know if it suits your needs,  
Roman, Wombats Corp

comments: author: Hans-Joachim Fritz
body: thank you very much for your effort, but I am looking for somehow standard solution. I'm simply not able or grantet rights to use this macro. Anyway thank you very much.


author: Roma Bubyakin
body: In this case, the option from [@Barbara Szczesniak](/t5/user/viewprofilepage/user-id/5187859) can be used "as is"

Have a nice day,  
Roman


Tags: cloud

confluence-cloud