ews-javascript-api
ews-javascript-api copied to clipboard
Failing to fetch .msg file attachment from ews exchange server ews-javascript-api
I have been using ews-javascript-api for fetching the emails and attachments. The below code fails to fetch the .msg file attachments.
Approach 1: Works for non .msg file attachments but fails for .msg file type:
**await file.Load()**
Approach 2: Fails to fetch the .msg file type attachment (Refer below code).
const { PropertySet, ItemSchema} = require('ews-javascript-api')
const itemId = new ItemId(file.id)
const ATTACHMENT_PROP_SET = new PropertySet([ItemSchema.MimeContent])
const msgEmailItem = await EmailMessage.Bind(EWS, itemId, ATTACHMENT_PROP_SET)
const base64Content = msgEmailItem.MimeContent.content
have you tried this approach with their C# counterpart? that will help resolve issue or find the proper code solution
Hi Gautam, Thank you for the response. I have never programmed C#, I know only javascipt.
the problem you are facing is that someone has to know how this works, Microsoft has only c# examples, which mostly works without much modification and using await keywords only.
this library is only port of c# version, if this works in c# side it should work here. but if that does not work in c#, then it definitely not going to work here.