ews-javascript-api icon indicating copy to clipboard operation
ews-javascript-api copied to clipboard

Failing to fetch .msg file attachment from ews exchange server ews-javascript-api

Open VikramMaiya opened this issue 2 years ago • 4 comments
trafficstars

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

VikramMaiya avatar Dec 28 '22 08:12 VikramMaiya

have you tried this approach with their C# counterpart? that will help resolve issue or find the proper code solution

gautamsi avatar Dec 28 '22 14:12 gautamsi

Hi Gautam, Thank you for the response. I have never programmed C#, I know only javascipt.

VikramMaiya avatar Dec 28 '22 14:12 VikramMaiya

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.

gautamsi avatar Dec 28 '22 14:12 gautamsi

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.

gautamsi avatar Dec 28 '22 14:12 gautamsi