AnsweredAssumed Answered

javascript reading aspect cm:attachments and also check the mimetype of some file and create from folder if plain/text

Question asked by hdalang on Apr 19, 2016
Latest reply on Apr 19, 2016 by hdalang
OK, the mimetype is working in my code so my problem is that I want to read attachment of my file, please help me doing that


var fileNames = space.children;

function main(){
  for (i=0; i<fileNames.length; i++){
    logger.log(fileNames.properties.content.mimetype);
    if(fileNames.isDocument && (fileNames.properties.content.mimetype).equals("text/plain")){
      //document.childAssocs
      var fileAttachments = fileNames.assocs['cm:attachments'][1];
      logger.log(i+" - "+fileNames.assocs['cm:attachments']);
    }
  };
/*
  for (i=0; i<fileAttachments.length; i++){
    logger.log("===================================================");
    logger.log(fileAttachments);
  };
*/
}
main();

Outcomes