Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Saving an attachment from Outlook
Message
 
À
17/06/2004 12:09:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00914650
Message ID:
00914665
Vues:
11
I tried the following code and it works for me. I use Outlook 2003.
LOCAL loOL As Outlook.Application, loMAPI As Outlook.NameSpace
LOCAL loMailBox, loInBox
LOCAL lnI As Integer, loAttachment, loItem

loOL = CREATEOBJECT("Outlook.Application")

*-- Get Mail Box
loMAPI = loOL.GetNamespace("MAPI")

*-- Get InBox
loMailBox = loMAPI.Folders(2)

*-- Loop Through Items with Attachment
loInBox = loMailBox.Folders(2)
FOR lnI = 1 TO loMailBox.Items.Count
    loItem = loMailBox.Items(lnI)
    IF loItem.Attachments.Count = 1
            loAttachment = loItem.Attachments(1)
            loAttachment.SaveAsFile("c:\OO.msg")
    ENDIF
NEXT
>Hi All,
>
>I have an application which reads the messages in outlook, searches for certain messages and then has to save the attachments on a different location.
>The problem I encounter is that I get an OLE IDispatch code 4096 from Microsoft Outlook, cannot save the attachment, access is denied.
>
>How do I overcome this problem? I use XP.
>
>Thanks in advance
>
>Jonathan
- Jayesh
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform