AnsweredAssumed Answered

Script checking files in folder for Aspect

Question asked by d_franz on Dec 6, 2012
I'm trying to write javascrips that are started by folder rule for creation, update and delete of a file for all folders and subfolders.
I want to set a indicating aspect to a folder if any file in it is without a specific aspect. If every file has this aspect the indicating aspect should be removed from the folder.

It is no problem to remove aspects from files and folder for single actions. It looks like my problem is that I can't check every file in a folder by a rule.

In the moment my scripts are looking like this:
Update a File:

var ainfo = true;
for each (var doc in space.children)
{
   if(!(doc.hasAspect("nci:archivalInfo")))
   {
      ainfo = false;         
   }      
}

if(ainfo == false)
{
   document.parent.addAspect("marker:asp_No_ArchivInfo");         
}
else
{
   document.parent.removeAspect("marker:asp_No_ArchivInfo");   
}

I am happy about every hint!

Outcomes