I would like to display a limited number of the last-modified/uploaded page attachments. For example, to generate a list of the latest 3-5 documents that have been attached to the page. If I use "Attachment table" I can limit the number of attachments to retrieve but the problem is that it's sorted by File name and not by modification date. However, "Attachments" macro allows sorting by date but then I have to display the complete attachment list. I can achieve the desired result by using "Content by Label" macro but I would like to avoid labelling each file.
Would you happen to know any work around to this?
Thanks,
Hey @Ilze Karklina,
one of the workarounds that I could think of is by embedding SQL for Confluence plugin into your Confluence page:
select c.TITLE as Attachment_Name
from CONTENT c
join CONTENT c2 ON c.PAGEID = c2.CONTENTID
join CONTENTPROPERTIES cp on c.CONTENTID = cp.CONTENTID
join SPACES s on c2.SPACEID = s.SPACEID
where c.CONTENTTYPE = 'ATTACHMENT'
AND propertyname = 'FILESIZE'
AND c2.title = '<pageTitle>'
AND s.spacename = '<spaceName>'
ORDER BY c.lastmoddate
LIMIT 5;
I limit the results to 5 in this query, but you could modify the value too.
Hope this helps :)
Thanks! I will try this! :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.