Hello!
I want to delete blog posts from a space. In my particular case, I can delete all, but it seems better to delete only posts that are older than a selected date.
I'm looking forward to tips.
Greetings Susanne
Hi @Susanne B What comes into my mind first is creating a page (e.g., Posts for Deletion) and reordering all posts which you want to delete as its child pages. Then remove the page and in the pop-up window check the "Also delete child pages" mark. This may work if you have dates in your blog post titles to sort them out while reordering
Ironically I love this answer because my personal blog posts are per month & year which makes deleting old data quick and easy !
Yes, exactly! Order is King!
@Susanne B : Sadly there is no standard "search => criteria:<date // delete" function.
But... it's Server, so how hardcore do you want to get?? A macro could be written if your Atlassian Admin / Development team are up for the challenge:
https://developer.atlassian.com/server/confluence/
Thanks for the quick reply.Moving the posts would also only go individually and not collected at once, wouldn't it? So that I have to open and move or delete all posts one after the other.
Thanks anyway.
I hoped that Scriptrunner would provide me with a suitable built-in script like the one that deletes obsolete comments on pages. Unfortunately no.We may find someone in the development who feels called to do so, but the requirement probably doesn't come often enough.Thank you very much!
Hello there,
We were able to successfully delete all blogposts from a space with a groovy script and a CQL query (requires Scriptrunner, use console).
Hope this help.
import com.atlassian.confluence.pages.PageManagerimport com.atlassian.sal.api.component.ComponentLocatorimport com.atlassian.confluence.core.DefaultDeleteContextimport com.onresolve.scriptrunner.canned.confluence.utils.CQLSearchUtilsimport com.onresolve.scriptrunner.canned.confluence.utils.CQLSearchimport com.onresolve.scriptrunner.runner.ScriptRunnerImpldef pageManager = ComponentLocator.getComponent(PageManager)def cqlSearchUtils = ScriptRunnerImpl.scriptRunner.getBean(CQLSearchUtils)def cqlQuery = "space = 'YourSpaceKey' and type = blogpost"def cqlSearch = new CQLSearch()def pages = cqlSearchUtils.searchForPages(CQLSearch.fromQuery(cqlQuery))pages.each{ pageToDelete -> pageManager.trashPage(pageToDelete, DefaultDeleteContext.DEFAULT) log.error pageToDelete}
It looks like you're new here. Sign in or register to get started.