If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Getting Attachments from outlook folder

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-10-04, 15:28
mikezcg mikezcg is offline
Registered User
 
Join Date: Oct 2003
Posts: 311
Getting Attachments from outlook folder

I have a folder for certian work ( Amex charges ) that i have to do.
its name is UnallocAmex

Each email in the file has an attachment. I would like to automate the process of copying the attachments to a dir C:\Unalloc\

From there i create data tables (.net) and update date in my database (sql Server)

I CANT FIGURE IT OUT!!!!!!!!!!!!!

Any help greatly appreciated
Reply With Quote
  #2 (permalink)  
Old 08-10-04, 16:58
mikezcg mikezcg is offline
Registered User
 
Join Date: Oct 2003
Posts: 311
for anyones info:

the restriction isnt one at all it is to & my name

Dim i, j As Integer
Dim oApp As Outlook.Application = New Outlook.Application
Dim sClassComp = "IPM.Note" ' String used for comparison with mail item.
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI") 'Get mapi namespace
Dim file As System.IO.FileInfo
Dim s As String = "_Unallocated Amex"
' Get Messages collection of Inbox.
Dim oInbox As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderInbox)
Dim oItems As Outlook.Items = oInbox.Folders.Item(s).Items
Dim oAttachment As Outlook.Attachment
Dim oMsg As Outlook.MailItem

oItems = oItems.Restrict("[to]= Michael Kerr")
' Loop each message.
For i = 1 To oItems.Count
'Test to make sure item is a mail item
'and not a meeting request.
If oItems.Item(i).MessageClass = sClassComp Then
oMsg = oItems.Item(i)
For j = 1 To oMsg.Attachments.Count
oAttachment = oMsg.Attachments.Item(i)
Debug.WriteLine(oAttachment.FileName)
Next
End If
Next
' Clean up.
oApp = Nothing
oNS = Nothing
oItems = Nothing
oMsg = Nothing
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On