Hi
I want to backup my reports from a script, can it be done? I read some post, but I didn't find one to guide what I want to do Hope any one can help
Regards
Diego A.
Hi,
By using the ScriptAdmin component, you can achieve what you are trying to do, hre a rough example:
var scriptAdminComponent = Context.getComponent("ScriptAdmin") ;
var categories = scriptAdminComponent.getCategories(1, 1033);
for(var i=0; i<categories.length; i++){
var categoryId = categories[i].getCategoryID();
var categoryName = categories[i].getName();
var scriptsInfosInCategory = scriptAdminComponent.getScriptInfos(1, categoryId,1033);
for (var j = 0; j < scriptsInfosInCategory.length; j++){
var zippedData = scriptAdminComponent.exportFile(1, categoryId,scriptsInfosInCategory[j].getID()).getData();
var filePath = "something.js";
var javaFile = new java.io.File(filePath);
Packages.org.apache.commons.io.FileUtils.writeByteArrayToFile(javaFile, zippedData);
}
}