List emails from Microsoft Outlook

Retrieve a list of email messages from a specific folder using Microsoft Graph API. Supports filtering with OData syntax and pagination.

yaml
type: "io.kestra.plugin.microsoft365.outlook.list"

List recent emails from inbox

yaml
id: list_outlook_emails
namespace: company.team

tasks:
  - id: list_emails
    type: io.kestra.plugin.microsoft365.outlook.List
    tenantId: "{{ secret('AZURE_TENANT_ID') }}"
    clientId: "{{ secret('AZURE_CLIENT_ID') }}"
    clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
    userEmail: "user@example.com"
    folderId: "inbox"
    top: 10

List emails with filter and store to internal storage

yaml
id: list_filtered_emails
namespace: company.team

tasks:
  - id: list_emails
    type: io.kestra.plugin.microsoft365.outlook.List
    tenantId: "{{ secret('AZURE_TENANT_ID') }}"
    clientId: "{{ secret('AZURE_CLIENT_ID') }}"
    clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
    userEmail: "user@example.com"
    folderId: "inbox"
    filter: "isRead eq false and receivedDateTime ge {{ now() | dateAdd(-7, 'DAYS') | date('yyyy-MM-dd') }}T00:00:00Z"
    top: 50
    fetchType: STORE

Get first message only

yaml
id: get_first_email
namespace: company.team

tasks:
  - id: get_first
    type: io.kestra.plugin.microsoft365.outlook.List
    tenantId: "{{ secret('AZURE_TENANT_ID') }}"
    clientId: "{{ secret('AZURE_CLIENT_ID') }}"
    clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
    userEmail: "user@example.com"
    folderId: "inbox"
    fetchType: FETCH_ONE
    top: 1
Properties

Client ID

Azure application (client) ID

Client Secret

Azure client secret

Tenant ID

Azure tenant ID (directory ID)

User email

Email address of the user whose mailbox to access (optional, uses authenticated user if not specified)

Default FETCH
Possible Values
STOREFETCHFETCH_ONENONE

The way you want to store the data

FETCH - outputs the messages as an output FETCH_ONE - outputs the first message only as an output STORE - stores all messages to a file NONE - no output

Filter

OData filter expression to filter the results (e.g., 'isRead eq false', 'from/emailAddress/address eq 'sender@example.com'')

Default inbox

Folder ID

Email folder to retrieve messages from (inbox, sentitems, drafts, deleteditems, or folder ID)

Default https://graph.microsoft.com/.default

Scopes

Scopes for Microsoft Graph

Default 50

Top

Maximum number of messages to return

User Principal Name

User email to act on behalf of (optional)

Default 0

Message count

Number of messages retrieved

Folder ID

ID of the folder that was queried

Has next page

Whether there are more messages available

Single message (when fetchType is FETCH_ONE)

List of messages (when fetchType is FETCH)

Format uri

URI of the stored messages file (when fetchType is STORE)

Format date-time
Format date-time