cancel
Showing results for 
Search instead for 
Did you mean: 

Add Aspect only to Files and not to folders

d_franz
Champ on-the-rise
Champ on-the-rise
I am trying to write a script that applies an aspect to every file. The problem is that with "document.addAspect" also the folders get this aspect.

Is there a command to identify a folder/space?

I want to run this script by a folder rule
2 REPLIES 2

abarisone
Star Contributor
Star Contributor
Hi,
if you look here http://wiki.alfresco.com/wiki/4.0_JavaScript_API#ScriptNode_API you will find some useful methods like
node.isContainer
node.isDocument
that migth help you accomplish what you need.

Regards,
Andrea

d_franz
Champ on-the-rise
Champ on-the-rise
OK! The Solution was very simple:
if (document.isContainer)
{
   document.addAspect("prefix:aspect");
}