As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
var activeFolder = companyhome.childByNamePath("Content_Expiry"); var archivedFolder = companyhome.childByNamePath("Content_Expiry/ExpiredContent"); if(activeFolder != null) { var i=0; activeChildren = activeFolder.children; activeTotal = activeChildren.length; for(i=0; i<activeTotal;i++) { child = activeChildren[i]; child.move(archivedFolder); } }
var fullcurrentpath = "/www/avm_webapps/ROOT/Folder1"; var fullarchivepath = "/www/avm_webapps/ROOT/Folder2"; var stores = avm.stores; var currentFolder = avm.lookupNode(stores[3].id + ":" + fullcurrentpath); var archivedFolder = avm.lookupNode(stores[3].id + ":" + fullarchivepath); if(currentFolder != null) { var i=0; activeChildren = currentFolder.children; activeTotal = activeChildren.length; for(i=0; i<activeTotal;i++) { child = activeChildren[i]; child.move(archivedFolder); } }
var currentFolder = avm.lookupNode("ContentExpiry–admin:/www/avm_webapps/ROOT"); var archivedFolder = avm.lookupNode("ExpiredContent–admin:/www/avm_webapps/ROOT/Folder1"); if(currentFolder != null) { var i=0; activeChildren = currentFolder.children; activeTotal = activeChildren.length; for(i=0; i<activeTotal;i++) { child = activeChildren[i]; if(child != 'Folder1') { child.move(archivedFolder); } } }
// … child = activeChildren[i]; childName = child.name; if(childName != 'Folder1') { child.move(archivedFolder); } // …
It sounds like you are moving nodes that reside in a Web Project, which means you are working with the AVM store. I don't think you can get to an AVM node using companyhome's childByNamePath function (I could be wrong).Have you taken a look at the AVM JavaScript API and the avm.lookupNode(path) function? Here's the wiki page with the doc:http://wiki.alfresco.com/wiki/3.4_JavaScript_API#AVM_APIJeff