We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

MapiMessage.Body is empty sometimes

I have message defined as:
image.png (6.5 KB)

An exception is thrown with some, but not most emails when executes the following call to get the length of the Body:
image.png (5.0 KB)

message.Body for the impacted email is coming through as ‘Nothing’

The message that causes the failure does have a body. What I then noticed is there are 2 Body properties:
image.png (32.4 KB)

How can I reference the one that has the data?

Hello @Alec_M,

What I then noticed is there are 2 Body properties:

Please specify which 2 Body properties are you referring to? It is not quite clear from the image…
Also, can you send an example of a message that has a problem?
Thank you.

Hi Dmitry,

I have attached a copy of the email.

WRT the 2 Body properties, in the screenshot below you can see that there is one called Body (Aspose.Email.Mapi.MapiMessageItemBase) which correctly contains the body of the email, and there is a second one called Body which contains Nothing.

I can’t see how I can reference the one that actually contains the body text.

Invoice 4822.pdf (868 KB)

@Alec_M,

Thank you for the info provided. I have created the EMAILNET-40923 investigation ticket.

Hi Dmitry, I have since managed to get my code to work by casting as follows:

        Dim sBody As String = message.Body
        If String.IsNullOrWhiteSpace(sBody) Then
            sBody = DirectCast(message, Aspose.Email.Mapi.MapiMessageItemBase).Body
        End If

What I feel I should add is that my application is a data import tool and uses Aspose libraries to read emails from MSG files in folders and from PSTs and that it only fails with the problem file when it is in a PST, so I would suggest that your developers check that area :slight_smile:

@Alec_M,

Thank you for the additional info.
In any case, an issue like this needs to be checked.

I agree, it looks like a bug to me.