Extract attachment from mail with MAPI 
Author Message
 Extract attachment from mail with MAPI

Hello! Everybody!
Is it possible to extract an attachment from e-mail using MAPI and
record it on hard disc?
If not, is there an other solution?
Thanks in advance!
M'sieur FUGE


Mon, 14 May 2001 03:00:00 GMT  
 Extract attachment from mail with MAPI
Try this on for size

'This bit of code will strip attachments and save them into the path
'"C:\temp\Outlook Attachments", it has no error handling so be warned!
'Code starts (placed under a command button.)
Dim oApp As Outlook.Application
Dim oNameSpace As NameSpace
Dim oFolder As MAPIFolder
Dim oMailItem As Object
Dim sMessage As String
Set oApp = New Outlook.Application
Set oNameSpace = oApp.GetNamespace("MAPI")
Set oFolder = oNameSpace.GetDefaultFolder(olFolderInbox)
    For Each oMailItem In oFolder.Items
        With oMailItem
            If oMailItem.Attachments.Count > 0 Then '?
               oMailItem.Attachments.Item(1).SaveAsFile "C:\Temp\Outlook
Attachments\" & oMailItem.Attachments.Item(1).filename
               MsgBox oMailItem.Attachments.Item(1).DisplayName & " was
saved as " & oMailItem.Attachments.Item(1).filename
           End If
        End With
    Next oMailItem
Set oMailItem = Nothing
Set oFolder = Nothing
Set oNameSpace = Nothing
Set oApp = Nothing

Quote:

>Hello! Everybody!
>Is it possible to extract an attachment from e-mail using MAPI and
>record it on hard disc?
>If not, is there an other solution?
>Thanks in advance!
>M'sieur FUGE



Tue, 15 May 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Extract attachment from mail with MAPI

2. MAPI: Extracting attachments

3. Extracting fields from Mail forwarded as attachment

4. Saving Mail Attachments with MAPI

5. How to save MS-Mail Attachment (mapi)

6. Sending e-mail without attachment using MAPI controls

7. MAPI Message control loses attachments details for Internet E-mail

8. Downloading attachment from MAPI mail message

9. MAPI controls - mail message attachments

10. Extract URL Links from Page, Navigate to these URL's and Extract E-Mail

11. Extract several e-mail addresses from e-mails

12. Attachments for e-mail in mail merge

 

 
Powered by phpBB® Forum Software