Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Substitute for Space-Attachment Macro?

Hans-Joachim Fritz
Contributor
March 27, 2024

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.

2 answers

1 accepted

0 votes
Answer accepted
Barbara Szczesniak
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.
March 27, 2024

@Hans-Joachim Fritz 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? 

Hans-Joachim Fritz
Contributor
March 27, 2024

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.

 

Like Barbara Szczesniak likes this
1 vote
Roma Bubyakin _Wombats Corp_
Contributor
March 28, 2024 edited

Hello @Hans-Joachim Fritz 

You might try our User Macro for Confluence Cloud 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.

Attachments in the Space macro

Here is how it looks like on the page:

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

Hans-Joachim Fritz
Contributor
March 28, 2024

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.

Roma Bubyakin _Wombats Corp_
Contributor
March 28, 2024

In this case, the option from @Barbara Szczesniak can be used "as is"

Have a nice day,
Roman

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Upcoming Confluence Events