Outlook inbox??

Greetings,
I have connected to MS Outlook using this code,
/* create outlook instance */
CREATE "Outlook.Application":u vhOutlook CONNECT NO-ERROR.

What do I require to check the inbox for a message FROM an address?
TIA
 

StefGay

Member
HI, this is a VB6 code but you can easily translate in 4GL by replacing . by : where there are properties/methods references.
In 2 words, create an object wich point to the MAPI namespace, an other for the folder you want to examine (inbox in your case) and scan the Items list.

Hope it helps.

STéphane.

Here is the vb6 code.

Set nsOutlook = CreateObject("Outlook.Application").GetNamespace("MAPI")
If Not nsOutlook Is Nothing Then
Set fldInBox = nsOutlook.GetDefaultFolder(olFolderInbox)
Set fldDossier = Nothing
For Each fldListDos In fldInBox.Folders
If fldListDos.Name = sDossier Then
Set fldDossier = fldListDos
Exit For
End If
Next fldListDos
If Not fldDossier Is Nothing Then
For iCpt = 1 To fldDossier.Items.Count
'-- Si c'est un Mail alors on sauvegarde la pièce jointe associée
If fldDossier.Items(iCpt).Class = olMail And fldDossier.Items(iCpt).UnRead Then
Set atPJ = fldDossier.Items(iCpt).Attachments(1)
'-- Sauvegarde du fichier correspondant.
atPJ.SaveAsFile sRepert & atPJ.FileName
fldDossier.Items(iCpt).UnRead = False
End If
Next iCpt
End If
Set nsOutlook = Nothing
End If
 
Top