Forum Discussion
Hi Angela!
Didn't you yourself answer a similar question in this blog post? It would mean relying on the Aras REST API instead of using JS IOM, though.
Or did I misunderstand the question?
Cheers,
C
Hi Cogres,
you wouldn´t believe how often I google for a specific Innovator topic just to figure out that I already asked or answered the same question some time ago .[emoticon:33306c418930400bac28808410f8ac8b]
In this case you are right with your linked forum topic. The use case is quite similar. But I don´t want to stream a file from an external location. I just want to access a file, that is already available in Innovators own file vault. So I don´t think it´s very efficient to use a REST connection just to access data that the user already can access.
This is my latest idea:
var fileId = document.thisItem.getProperty("native_file");
var fileDownloadUrl = aras.IomInnovator.getFileUrl(fileId , aras.Enums.UrlType.SecurityToken);
var request = new XMLHttpRequest();
request.open('GET', fileDownloadUrl, true);
request.send(null);
request.onreadystatechange = function () {
if (request.readyState === 4 && request.status === 200) {
var type = request.getResponseHeader('Content-Type');
if (type.indexOf("text") !== 1) {
alert(request.responseText);
}
}
};
In this sample I create a temporary file download link and then read the file content from the link. But I am not sure if this one is a recommended way to solve this task.
Would be happy if somebody knows a more straight and lean variant.