function main() {
try {
var parent = document.parent;
var docname = document.name;
if (docname.indexOf(".eml") > 0) {
logMaison(LOG_DEBUG, "DeleteEmail/main", "The document is an email");
if(docname.indexOf("_") > 0) {
logMaison(LOG_DEBUG, "DeleteEmail/main", "The document's name contain a ID");
var indexUnder = docname.indexOf("_");
var indexExtension = docname.indexOf(".eml");
var key = docname.substring(indexUnder, indexExtension);
logMaison(LOG_DEBUG, "DeleteEmail/main", "The key is <"+key+">");
var children = parent.children;
for (var i = 0; i < children.length; i++) {
var childName = String(children.name);
if (childName.indexOf(key) > 0 && children.isContainer) {
logMaison(LOG_DEBUG, "DeleteEmail/main", "This child contain the key. Deleting <"+childName+">");
// Ici, je change quelques aspects, je pensais que c'était du à ça mais visiblment non
children.addAspect("sys:temporary");
children.removeAspect("sys:hidden");
children.save();
if (children.remove()) {
logMaison(LOG_DEBUG, "DeleteEmail/main", "<"+childName+"> deleted");
} else {
logMaison(LOG_WARNING, "DeleteEmail/main", "Fail to delete <"+childName+">");
}
break;
}
}
} else {
logMaison(LOG_WARNING, "DeleteEmail/main", "The current document don't include key");
}
} else {
logMaison(LOG_WARNING, "DeleteEmail/main", "The document is not an email");
}
} catch(e) {
logMaison(LOG_ERROR,"DeleteEmail/main", "Failed to execute the function : error message = "+e.toString());}
}
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.