Skip to content

Outlook Get Emails

Type: outlook-get-emails  ·  Package: Outlook Activities v1.0.0  ·  Output: List

Reads emails from an Outlook folder and returns a list of messages (ZoanMail). It is the starting point of almost every email-based process: reading what arrived, scrolling through it, and acting on each message.

Read the emails from the indicated folder (by default Inbox), ordered from most recent to oldest, up to maxCount. You can limit to unread (unreadOnly) or apply an Outlook DASL filter. Each mail in the list has properties like .Id (its EntryID), .Subject, .From, .Body, .Attachments — see ZoanMail.

Ninguno.

ParameterEditorDescription
sessionsessionOutlook Connect session. If omitted, use the default account.
folderexpressionFolder name. By default Inbox. Use / for subfolders: "Inbox/Clientes".
maxCountexpressionMaximum number of emails to return. By default 50.
unreadOnlybooleanReturn only unread ones. By default false.
filterexpressionFiltro DASL de Outlook. Ej: "[Subject] = 'Factura'".

Returns a List of emails (ZoanMail). Go through it with For Each.

Read unread emails with “Invoice” in the subject and process them:

Outlook Get Emails
folder = "Inbox"
unreadOnly = true
filter = "[Subject] = 'Factura'"
→ output: correos
For Each items = = correos itemVariable = correo
└─ activities:
Log message = = "De: " + correo.From + " — " + correo.Subject
Outlook Get Attachments entryId = = correo.Id outputDir = "C:/facturas" → output: archivos
Outlook Mark Read entryId = = correo.Id