Convert Byte Array to Outlook Mail Item object

Tobias Price 0 Reputation points
2023-03-30T15:18:12.5966667+00:00

Hello,

I have a blazor application, which consumes an API, which sends it .msg files as byte arrays.

I cannot download or save the byte array anywhere, so I wondered if it is at all possible to read the byte array into something like an Outlook Mail Item, in memory, so I can access the Subject, body etc. and display them?

Open to using 3rd party libraries, or a complete viewer solution.

At the moment, the only was I can access them is to save them, and it isn't a solution going forward.

Any help, suggestions appreciated.

Thanks

Developer technologies .NET Blazor
Developer technologies C#
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-03-30T15:31:58.15+00:00
    1 person found this answer helpful.

  2. RLWA32 49,536 Reputation points
    2023-03-30T15:57:51.72+00:00

    .MSG files are compound files that can be accessed by the Structured Storage API. Their format is documented at [MS-OXMSG]: Outlook Item (.msg) File Format.

    Conceptually, the CreateILockBytesOnHGlobal function and the StgOpenStorageOnILockBytes function could be used to obtain access to a .msg file in memory.

    It goes without saying that this would not be a trivial undertaking. However, it might be worth investigating if you cannot find a simpler and more user-friendly alternative.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.