Results 1 to 6 of 6

Thread: autorun outlook from winforms

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2004
    Posts
    43

    Wink autorun outlook from winforms

    Hi,

    I'm really stuck on this.

    Suppose I have an outlook email (Ei0001.eml) that is stored on my C-disk on the location: c:\email\Ei0001.eml .

    Suppose that I have a button on my form that when it's clicked should open the specified email (Ei0001 in this case).

    How do I have to code this?

    Thanks.

  2. #2

    Thread Starter
    Member
    Join Date
    Jan 2004
    Posts
    43
    I tried the following

    VB Code:
    1. imports system.io
    2.  
    3.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    4.         Dim filename As String
    5.         Dim FS As FileStream
    6.  
    7.         filename = "C:\Eu0001.eml"
    8.         FS = File.Open(filename, FileMode.Open)
    9.  
    10.     End Sub

    But the email isn't opened. I get an error message:

    An unhandled exception of type 'System.IO.IOException' occurred in mscorlib.dll

    Additional information: The process cannot access the file "C:\Eu1224.eml" because it is being used by another process.


    While my outlook express isn't activated. What am i doing wrong??

    Jinte

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2004
    Posts
    43
    Nobody??

  4. #4
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    Try :
    VB Code:
    1. Process.Start("C:\Eu0001.eml")

    This should open the file in the asociated (spelling... ) program. In this case Outlook
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2004
    Posts
    43

    Thumbs up

    thanks pax,

    your suggestion worked.

    Jinte

  6. #6
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    Originally posted by jinte
    I tried the following

    VB Code:
    1. imports system.io
    2.  
    3.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    4.         Dim filename As String
    5.         Dim FS As FileStream
    6.  
    7.         filename = "C:\Eu0001.eml"
    8.         FS = File.Open(filename, FileMode.Open)
    9.  
    10.     End Sub

    But the email isn't opened. I get an error message:

    An unhandled exception of type 'System.IO.IOException' occurred in mscorlib.dll

    Additional information: The process cannot access the file "C:\Eu1224.eml" because it is being used by another process.


    While my outlook express isn't activated. What am i doing wrong??

    Jinte
    I think it's quite clear that what you're doing that way is OPENING the file as a stream and not EXECUTING it..
    \m/\m/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width