Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get the list of pictures attached AND inserted in a page with Scriptrunner?

Hi all, 

I'm trying to write a script to get a list of the picture/files which are actually used in a page, and not just attached to the page.

Starting from some scriptrunner templates/tutorials, I got to the point where I can list in a table the pages within a selected space, and in each row of the table I write the page name, the number of attachments, the name of the attachments, but not really the name of the attachments which are actually used somewhere in the body of the page.

In the picture below, there's a sample result.

I know that in the "Summary Report..." page all of the 16 attached pictures are also included in the body of the page, but I don't know how to represent this situation in the table.

I tried to use the extractLinkTextList, but realized that this doesn't return what I need.

 

image.png

 

here below the piece of code...

tbody {
pagesInfo.each { space, pages ->

if (pages.size() > 0) {
if (space.name =="CRUP") { //limit result to a specified name of space

pages.each { page ->
tr {
th() {
b(space.name)
}
td(page.title)
td(confluenceLinkResolver.extractLinkTextList(page.getBodyAsString()))
td(attachmentManager.countLatestVersionsOfAttachments(page))
td(attachmentManager.getLatestVersionsOfAttachments(page))

}
}
}
}

 

Could anyone propose the right approach?

Clearly later on I'd like to add code to process in some way this information, but for now I'd be very happy to ... just find the information :-) 

Thanks in advance.

Andrea

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

JSM June ask me anything (AMA)

Hello Community members! We’re wrapping up the end of JSM June with an Ask Me Anything (AMA) with the Jira Service Management product team. This is your chance to ask all your ITSM questions to o...

129 views 9 10
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you