Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to extract attachments from a MSG file
Message
From
03/02/2009 03:56:03
 
 
To
03/02/2009 02:00:53
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Web
Miscellaneous
Thread ID:
01378889
Message ID:
01378922
Views:
13
In my quest to get attachments from a .MSG file, I have tried this code:
        Dim loMessage As New CDO.Message
        Dim loStream As New ADODB.Stream

        loStream.Mode = ADODB.ConnectModeEnum.adModeReadWrite
        loStream.Type = ADODB.StreamTypeEnum.adTypeText
        loStream.Open()

        loStream.WriteText(oApp.FileToStr("d:\Test.msg"), ADODB.StreamWriteEnum.adWriteLine)

        loStream.Position = 0

        loMessage.DataSource.OpenObject(loStream, "_Stream")

        MessageBox.Show(loMessage.From)
        MessageBox.Show(loMessage.To)
        MessageBox.Show(loMessage.TextBody)
While this doesn't generate any error, it doesn't recognize the content of the file. Basically, all properties from loMessage return empty.

There has to be a small ajustment that has to be made in this code. I just can't find where it is.

Basically, I create a stream. Then, I use that into loMessage.DataSource.OpenObject() to have it into a CDO.Message. Is there anyone who would see what has to be adjusted?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform