Hello,
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()
newpage.setSpace(tgtSpace)
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.
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!
Cheers,
Helmy
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.