Hello,
I try to do a recursive function to get all files in a node (even if the files are in different subfolders) and to stock them into an array. But the array I return is unexploitable..
The code I use :
function fillArray(alfrescoJsApi: AlfrescoJSApi, node:any, array: Array<any>) {
alfrescoJsApi.nodes.getNodeChildren(node).then( function (data) {
for(var entry of data.list.entries) {
if(entry.entry.isFolder == true) {
let id = entry.entry.id;
let newAlfrescoApi = <AlfrescoJSApi> new AlfrescoJSApi({
provider: 'ECM'
});
fillArray(newAlfrescoApi, id, array);
} else if(entry.entry.isFile == true) {
array.push( {[entry.entry.id]: entry.entry.name});
}
};
}, function (error) {
console.log('This node does not exist');
});
return array;
}Any ideas ?
Thanks