AnsweredAssumed Answered

Inherit metadata from space

Question asked by buurd on Aug 15, 2008
Latest reply on Aug 21, 2008 by buurd
Hi!

i'm trying to write a script that will make sure that all documents in a space will be populated with some common metadata from the space. But I can't get the code working (se code below). Am I using the alfresco api in the wrong way??

Thanks in advance
Roland


/**
* CopySpaceMetadata
*
* This script makes sure that a content "inherits" is containing space metadata.
* It will not overwrite already existing metadata about the content
*/

// Make sure that the content have the aspects the space has
for(var i in space.aspects){
    if(!document.hasAspect(i)){
        document.addAspect(i);
    }
}

// Set the properties from the space to the content, unless they already are set
for(var i in space.properties){
    if(document.property[i] == null){
        document.property[i] = space.properties[i];
    }
}

Outcomes