I am trying to access outlook mail api and trying to download attachment in mails. For smaller attachments, it works fine. For something more than 1MB it just fails.
async downloadAttachment(mail: ET.IOutlookMailItem, att: ET.IOutlookMailAttachment) {
this.graphService.getRawAttachment(mail.id, att.attachmentId).then(resp => {
// saveAs is from file-saver for blob saving
saveAs(resp, att.attachmentName);
});
}
async getRawAttachment(messageid: string, attachmentid: string): Promise<any> {
try {
let result = await this.graphClient
.api('/me/messages/' + messageid + '/attachments/' + attachmentid + '/$value')
.get();
return result;
} catch (error) {
console.log(error);
}
}