Loading...
Apify Actor

Outlook Inbox Reader API

Process and structure your Outlook / Office 365 inbox using Microsoft Graph API. Filter emails by sender, subject, body text, date range, unread/read, and save bodies + attachments into a clean dataset for HR, invoices, leads, support, and compliance.

What it does

This actor connects to Microsoft Graph API and retrieves emails from one or more Outlook / Office 365 mailboxes based on your filters. Results are saved into an Apify Dataset with both bodyHtml and bodyText. Attachments (optional) are downloaded and stored in Apify Key-Value Store, then linked back to each dataset item for easy access and exporting.

Key features

  • Application & Delegated auth modes supported
  • Filter by sender, subject, body text, date range, unread/read
  • Choose folders (Inbox, All Mail, custom)
  • Download attachments with filename/extension/size filters
  • Store email bodies (bodyHtml, bodyText) in dataset
  • Flattened recipients (to, cc, bcc)
  • Quick columns for attachment names & paths + full attachment array
  • Optionally mark processed emails as read

Key data fields (dataset columns)

  • Mailbox (mailbox)
  • Message ID (id)
  • Received & Sent datetime (receivedDateTime, sentDateTime)
  • Subject (subject)
  • From / To / CC / BCC (from, to, cc, bcc)
  • Read status (isRead)
  • Body preview + full bodies (bodyPreview, bodyHtml, bodyText)
  • Conversation ID (conversationId)
  • Attachment names (comma-separated) (attachmentNames)
  • Attachment KV paths (comma-separated) (attachmentPaths)
  • Full attachment array (attachments)

How to use

  1. Choose an auth mode: application (Azure App + tenant mailbox access) or delegated (user access token).
  2. Provide credentials:
    • Application mode: tenantId, clientId, clientSecret, and mailboxes
    • Delegated mode: userAccessToken and mailboxes
  3. Set filters (optional): dateFrom, dateTo, senderEmails, subjectIncludes, bodyIncludes, onlyUnread, folders, and limits like maxMessagesPerMailbox.
  4. If you need files, enable attachments and set attachment filters: attachmentExtensions, attachmentMinSizeKB, attachmentMaxSizeKB, attachmentNameIncludes, attachmentNameExcludes.
  5. Run the actor and export dataset items as JSON/CSV, with attachment KV links included.

Sample Output JSON

{
  "mailbox": "billing@yourdomain.com",
  "id": "AAMkAGVmMDEzYj... (Graph message id)",
  "receivedDateTime": "2025-11-18T09:15:22Z",
  "sentDateTime": "2025-11-18T09:14:58Z",
  "subject": "Invoice #48291 - November",
  "from": "vendor@example.com",
  "to": "billing@yourdomain.com",
  "cc": "",
  "bcc": "",
  "isRead": false,
  "bodyPreview": "Hi, please find attached invoice #48291...",
  "bodyHtml": "<html>...</html>",
  "bodyText": "Hi, please find attached invoice #48291...",
  "conversationId": "AAQkAGVmMDEzYj...",
  "attachmentNames": "invoice_48291.pdf",
  "attachmentPaths": "inbox-attachments/billing@yourdomain.com/AAMkAGVmMDEzYj.../invoice_48291.pdf",
  "attachments": [
    {
      "name": "invoice_48291.pdf",
      "contentType": "application/pdf",
      "size": 245812,
      "extension": ".pdf",
      "kvPath": "inbox-attachments/billing@yourdomain.com/AAMkAGVmMDEzYj.../invoice_48291.pdf"
    }
  ]
}