Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How can I copy a toplevel page from one space to another?



I am trying desperately to copy a toplevel page from one space to another, but I seriously don't understand or find the API mechanism for it. What I am currently doing is:

ListBuilder<Page> lsbPages = pgmgr.getTopLevelPagesBuilder(srcSpace)

for(int i=0; i<lsbPages.getAvailableSize(); i++){
Page page = lsbPages.getPage(i, 1).get(0)

Page newpage = (Page) page.clone()
//Page newpage = (Page) page.copyLatestVersion()


pgmgr.movePageToTopLevel(newpage, tgtSpace)
//pgmgr.saveContentEntity(newpage, null)
//pgmgr.saveContentEntity(newpage, page, null)

but all it does is nothing... I either don't know if the cloning procedure is correct or if I need to use something else and I feel like there is also something missing to store the page correctly, but I have no clue what and the API docu is not really helpful. Currently I am just guessing. It is way different from what I am used to in Jira...

The only things I can find are about copying when there is already a page, but I am looking for creating basically a new page at top level (ideally a clone).

Can someone point me into the right direction? Was checking for sources the entire day, but no luck.

1 answer

Hi Michael,

The method movePageToTopLevel will not actually move/copy the page to another space. It would only order the page in a page tree.

We have a built-in script to copy a page tree from one space to another: Copy Page Tree

I hope this helps! 


Suggest an answer

Log in or Sign up to answer

Atlassian Community Events