bgaines72 posted this code:
Is there a way to save an attachment from a specific email address to the c: drive?
Thanks
Code:
Dim olApp As Outlook.Application = New Outlook.Application()
Dim olNS As Outlook.NameSpace = olApp.GetNamespace("MAPI")
olNS.Logon("Brian Gaines", "", False, True)
Dim olInbox As Outlook.MAPIFolder = olNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
Dim olItems As Outlook.Items = olInbox.Items
Dim i As Integer
Try
If olItems.Count > 0 Then
ListBox1.Items.Clear()
For i = 1 To olItems.Count
Dim email As Outlook.MailItem = olItems.Item(i)
ListBox1.Items.Add(email.Subject & " >>> FROM: " & email.SenderName)
Next
Label1.Text = "Emails: " & (i - 1).ToString
olNS.Logoff()
End If
Catch ex As Exception
lblMessage.Text = ex.ToString
Finally
olApp = Nothing
olNS = Nothing
olItems = Nothing
olInbox = Nothing
End Try
Is there a way to save an attachment from a specific email address to the c: drive?
Thanks