AnsweredAssumed Answered

JavaScript to move content to a folder

Question asked by davix on Jun 3, 2011
Latest reply on Mar 4, 2012 by rajshree11
Hi,

I've written JavaScript to move content to a folder like this.

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);
}
}
I have a project called Content_Expiry under Web Projects. And I'm trying to move the content to a folder called ExpiredContent in the same project. However the above JavaScript doesn't work. Am I giving the paths wrong here –> companyhome.childByNamePath("Content_Expiry");

Please let me know, thanks!

Outcomes