Hello. How would I create a new space under Main or the toplevel entity from a java component. So far I'm doing this, but not sure.. DocumentReference docref = new DocumentReference(serverName,pageSpace,pageName); if(xwiki.exists( docref, xcontext)){ //skip create do other stuff }else{ XWikiDocument doc = new XWikiDocument(docref); doc.setTitle(pageName); DocumentReference docrefparent = new DocumentReference(serverName,pageSpace,"WebHome"); doc.setParentReference(docrefparent); xwiki.saveDocument(doc, xcontext); } Where: serverName = $request.serverName pageSpace = "Main" pageName = "NewPage" is there anything else I need to set on the document or am I referencing wrong? Not sure why it is not creating the page.. -- View this message in context: http://xwiki.475771.n2.nabble.com/Create-spaces-and-page-in-toplevel-space-v... Sent from the XWiki- Users mailing list archive at Nabble.com.