gaoyuanhe - Sunday, November 14, 2010 9:41 PM:
hi,
I write a method trying to download files from the document,but when the document contains more then one file,it willl show an error message,
Failed to download the file 'a.xls' into C:
The first flie has been downloaded.
Code is as follows :
function downloadFile(docId)
{
//Search by docId
var fileItems=innovator.newItem("document file","get");
fileItems.setProperty("source_id", docId);
fileItems.setAttribute("where", "related_id is not null");
fileItems = fileItems.apply();
if(fileItems.getItemCount()<1) {return;}
for(var n=0;n<fileItems.getItemCount();n++)
{
var fileItem = innovator.getItemById("File",fileItems.getItemByIndex(n).getID());
if (fileItem.isError()) {
top.aras.AlertError("File Not Found: " +fileItem.getErrorDetail());
return;
}
var fileName=fileItem.getProperty("filename");
// Get the URL to the file and download it
var fileURL = top.aras.getFileURLEx(fileItem.node);
var results = top.aras.vault.downloadFile(fileURL);
if (!results) {
top.aras.AlertError("Unable to retrieve the file ("+fileName+") from the vault");
return;
}
}
}
Someting wrong?
Thanks in advance.