Click here to Skip to main content
15,892,059 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Does performance reduces if i use always Public Sub or Sub instead of Private Sub? Pin
Mark Churchill30-Jun-08 20:18
Mark Churchill30-Jun-08 20:18 
AnswerRe: Does performance reduces if i use always Public Sub or Sub instead of Private Sub? Pin
N a v a n e e t h30-Jun-08 21:02
N a v a n e e t h30-Jun-08 21:02 
AnswerRe: Does performance reduces if i use always Public Sub or Sub instead of Private Sub? Pin
~Khatri Mitesh~30-Jun-08 21:34
~Khatri Mitesh~30-Jun-08 21:34 
QuestionHelp reg .ini file in vb 6.0 Pin
aaraaayen30-Jun-08 19:58
aaraaayen30-Jun-08 19:58 
AnswerRe: Help reg .ini file in vb 6.0 Pin
ChandraRam1-Jul-08 0:26
ChandraRam1-Jul-08 0:26 
AnswerRe: Help reg .ini file in vb 6.0 Pin
jzonthemtn1-Jul-08 4:57
jzonthemtn1-Jul-08 4:57 
QuestionRead Outlook Attachment Pin
RCoate30-Jun-08 16:33
RCoate30-Jun-08 16:33 
QuestionHalf a solution Pin
RCoate30-Jun-08 19:33
RCoate30-Jun-08 19:33 
After a bit more research, I have half an answer.
What I have managed to (sort of) get working is, save the attachment and then open it as a mail item.

I.E.
Try
    theAttachment.SaveAsFile("c:\TempAttachment.msg")
    Dim theItem As MailItem = CType(theONS.Application.CreateItemFromTemplate("C:\TempAttachment.msg"), MailItem)

    Dim theMessage As String = theItem.Body.ToString
    SaveEmailAddresses(theMessage)

Catch ex As InvalidCastException
    Dim theFileName As String = String.Concat("c:\TempAttachment", theErrorFile, ".msg")
    theAttachment.SaveAsFile(theFileName)
    theErrorFile += 1

Catch ex As System.Exception
    SaveEmailAddresses("Attachment@Failed.to.Open.com")
    theErrorCount += 1
    MsgBox(ex.ToString, MsgBoxStyle.Critical, "Error")

Finally
    File.Delete("c:\TempAttachment.msg")
End Try


The problem now is that only some of the attachments are being cast as MailItems correctly. The other half throw a InvalidCastException.

As far as I can see, there is little difference between the two types of attachments. Both use the same outlook message window when opened from the saved copy. In the original email, the ones that work have the "email" icon and the ones that don't have a different icon. (Sort of a circle with some wires coming from the top right).

Any one know how I can cast these last attachements as MailItems?Confused | :confused:
QuestionInstant CPU Utilization Value Pin
NeilPrice30-Jun-08 11:40
NeilPrice30-Jun-08 11:40 
AnswerRe: Instant CPU Utilization Value Pin
Thomas Stockwell30-Jun-08 11:56
professionalThomas Stockwell30-Jun-08 11:56 
GeneralRe: Instant CPU Utilization Value Pin
NeilPrice1-Jul-08 4:38
NeilPrice1-Jul-08 4:38 
QuestionTimer Question Pin
DCAUB30-Jun-08 10:13
DCAUB30-Jun-08 10:13 
AnswerRe: Timer Question Pin
Luc Pattyn30-Jun-08 10:41
sitebuilderLuc Pattyn30-Jun-08 10:41 
GeneralRe: Timer Question Pin
DCAUB30-Jun-08 12:26
DCAUB30-Jun-08 12:26 
GeneralRe: Timer Question Pin
Luc Pattyn30-Jun-08 12:35
sitebuilderLuc Pattyn30-Jun-08 12:35 
GeneralRe: Timer Question Pin
DCAUB30-Jun-08 20:19
DCAUB30-Jun-08 20:19 
QuestionC++ Controls in VB? Pin
Saul Johnson30-Jun-08 8:19
Saul Johnson30-Jun-08 8:19 
AnswerRe: C++ Controls in VB? Pin
Kenny McKee30-Jun-08 8:59
Kenny McKee30-Jun-08 8:59 
QuestionMenuStrip control searching by menue name Pin
Georg Kohler30-Jun-08 8:06
Georg Kohler30-Jun-08 8:06 
AnswerRe: MenuStrip control searching by menue name Pin
Thomas Stockwell30-Jun-08 11:12
professionalThomas Stockwell30-Jun-08 11:12 
GeneralRe: MenuStrip control searching by menue name Pin
Georg Kohler30-Jun-08 11:38
Georg Kohler30-Jun-08 11:38 
GeneralRe: MenuStrip control searching by menue name Pin
Thomas Stockwell30-Jun-08 11:51
professionalThomas Stockwell30-Jun-08 11:51 
AnswerRe: MenuStrip control searching by menue name Pin
Scott Dorman30-Jun-08 15:58
professionalScott Dorman30-Jun-08 15:58 
GeneralRe: MenuStrip control searching by menue name Pin
Georg Kohler30-Jun-08 16:13
Georg Kohler30-Jun-08 16:13 
GeneralRe: MenuStrip control searching by menue name Pin
Scott Dorman30-Jun-08 18:08
professionalScott Dorman30-Jun-08 18:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.