List the attachments of another page
Scenario
The Attachments macro only extracts attachment information from the current page. To retrieve information on attachments on other pages, use the recipe below.
In the example, the macro retrieved the first six attachments in a page called Aircraft Parts in the space PLANE and formatted the results in a table sorted by attachment name.
Result
Recipe
Apps | Reporting for Confluence Data Center |
|---|---|
Level | Easy |
Estimated time | 15 minutes |
Macros | Local Reporter, Report Column, Report Empty, Report Info, Report Table, Text Sort |
Suppliers | Attachment Supplier, Content Supplier |
Storage format
You can copy and paste this code into the Confluence Source Editor:
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="c22dc8ab-e104-4625-b628-00f0200f85c9" ac:name="report-table" ac:schema-version="1">
<ac:parameter ac:name="maxResults">6</ac:parameter>
ac:rich-text-body
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="47be588f-0881-46fa-9571-6b699565b283" ac:name="local-reporter" ac:schema-version="1">
<ac:parameter ac:name="source">PLANE:Aircraft Parts</ac:parameter>
<ac:parameter ac:name="">content:attachments</ac:parameter>
ac:rich-text-body
<ac:structured-macro ac:macro-id="6a759018-c4f2-46c5-bc95-305e565524e5" ac:name="text-sort" ac:schema-version="1">
<ac:parameter ac:name="">attachment:title</ac:parameter>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="a3a28fb3-5ff6-4a47-99a0-bb2b40550081" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">File Name</ac:parameter>
ac:rich-text-body
<p>
<ac:structured-macro ac:macro-id="b594ff2a-7ece-40b2-9a88-55c0ad75c288" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="link">true</ac:parameter>
<ac:parameter ac:name="">attachment:title</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="bbee1bb1-1d0c-45a6-8eef-fb2680e0fb2d" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Comment</ac:parameter>
ac:rich-text-body
<p>
<ac:structured-macro ac:macro-id="53d5ef1e-e5d2-43ca-9eb2-67771b058cb9" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="">attachment:comment</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="2c7a104a-9a2e-4a5b-ac0b-b726358882bd" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Size</ac:parameter>
ac:rich-text-body
<p>
<ac:structured-macro ac:macro-id="7dfb975d-ad59-46fa-9975-98c4b6a091bf" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="">attachment:nice file size</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br />
</p>
<ac:structured-macro ac:macro-id="1b955b0f-59f3-49a8-9d2a-a9e17f374908" ac:name="report-empty" ac:schema-version="1">
ac:rich-text-body
<p>No files have been attached to this page.</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br />
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br />
</p>
Macro structure
You can recreate the example in the editor view:
Steps
Create a Report Table macro with Maximum Results:
6.Within the Report Table, create a Local Reporter macro with the following parameters:
Key:
content:attachmentsSource:
PLANE:Aircraft Parts
Within the Local Reporter, create a Text Sort macro with Key:
attachment:title.Under the Local Reporter, create a Report Column with Title:
File Name.Within the File Name Report Column macro, create a Report Info macro with the following parameters:
Key:
attachment:titleLink to Item: selected
Under the File Name Report Column macro, create another Report Column macro with Title:
Comment.Within the Comment Report Column macro, create a Report Info macro with Key:
attachment:comment.Under the Comment Report Column macro, create another Report Column macro with Title:
Size.Within the Size Report Column macro, create a Report Info macro with Key:
attachment:nice file size.Under the Size Report Column macro, create a Report Empty macro.
Inside the Report Empty macro body, enter
No files have been attached to this page.