Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 6 Tagen, 8 Stunden
Letzter Beitrag:
vor 6 Tagen, 3 Stunden
Beteiligte Autoren:
Stefan Bentvelsen, Arie, Fabrice Harari

[WD22] MsgReader to read .msg files

Startbeitrag von Stefan Bentvelsen am 16.06.2017 13:41

Hi all,

I would like to get data from .msg-files on disk without the use of Outlook.
I found an open source .NET library MsgReader, but cannot get it to work.
I'm also not known with the use of this kind of libraries.
Is there someone who has a wordking example of the use of this library?

I've tried this:

pclMsgObj is MsgReader.Outlook.Storage.Message("RE Request for data (335 kB).msg","") dynamic
sSender is string
sSubject is string
sBodyHTML is string
sBodyText is string

sSender = pclMsgObj.Sender
sSubject = pclMsgObj.Subject
sBodyHTML = pclMsgObj.BodyHtml
sBodyText = pclMsgObj.BodyText

but it gives an error at runtime:

Error at line 11 of Click BTN_NoName1 process.
Dynamic .NET object ('pclMsgObj') not allocated.


Hi Stefan,

in your code, you are saying that pclMsgObj is DYNAMIC...

that implies that after that (and depending of the documentation of the .net assembly), you will have to either instantiate it (new) or get it back from the assembly via a method made for that.

Currently, you are defining the type of pclMsgObj, but are not creating the object.

Best regards

von Fabrice Harari - am 16.06.2017 13:57

you need something like this

pclMsgObj is MsgReader.Outlook.Storage.Message dynamic
pclMsgObj = new MsgReader.Outlook.Storage.Message("RE Request for data (335 kB).msg","")

von Arie - am 16.06.2017 14:30
Hi Fabrice, Arie,

when I declare the object like:

lusMessage is UNICODE string = "RE Request for data (335 kB).msg"

//pclMsgObj is MsgReader.Outlook.Storage.Message(lusMessage,1) //dynamic
pclMsgObj is MsgReader.Outlook.Storage.Message dynamic
pclMsgObj = new MsgReader.Outlook.Storage.Message(lusMessage)

I get an error:
Error:Syntax error on ..
WIN_MsgReaderTEst.BTN_NoName1, Click WIN_MsgReaderTEst.BTN_NoName1, line 5, column 34

on the point between 'Outlook' and 'Storage' of the second line (pclMsgObj = new MsgReader.Outlook.Storage.Message(lusMessage)). Same case when I use de literal direct instead of the unicode string.

von Stefan Bentvelsen - am 16.06.2017 18:35
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.