I have an addin
which calls a REST API and downloads a file as a BLOB.
I am using FileSaver
library to save the file in the local PC.
While everything works as expected in outlook 365 in chrome, Edge and IE11 browsers. The Outlook Desktop Client does not give the option to save the file. In fact, while debugging, I tried to look for some errors but I found none. All the code is working properly on the Outlook Desktop Client.
I want to know if the taskpane uses the IE browser, It should support the filesave.saveAs
method.
I also tried to using the link
// const link = window.document.createElement('a');
// this.error = `linke = ${link}`
// link.href = window.URL.createObjectURL(blob);
// this.error = `href = ${link.href}`;
// this.error = link.href;
// link.download = this.finalName;
// link.click();
It also did not work on the Outlook Desktop Client and it works as expected in browser versions.
The code which I am using right now is as below:
/**
Angular HttpClient is used to call a rest api which returns a blob.
which is passed to saveAs function to save the file.
**/
this.dsService.processAttachmentDownload(attachmentId, storageId)
.subscribe(data => {
const blob = new Blob([data], { type: 'application/octet-stream' });
saveAs(blob, this.finalName);
});