Try
Convert Byte Array to Outlook Mail Item object
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#
2 answers
Sort by: Most helpful
-
Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
2023-03-30T15:31:58.15+00:00 -
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.