EWS.Kit for Delphi – Exchange Server mailboxes through Exchange Web Services

EWS.Kit iconOn-premises Exchange 2016, 2019 and SE – mail, calendar, contacts, tasks, public folders

EWS.Kit reads and writes the mailboxes of an on-premises Exchange server – Exchange Server 2016, 2019 and Subscription Edition – through Exchange Web Services: the folder tree, messages with their attachments and their MAPI properties, sending, calendars, meetings and other users’ free/busy, contacts and private distribution lists, Outlook tasks, sticky notes and the journal, synchronisation and streaming notifications, the mailbox settings and the modern public folders.

A message read through EWS is an IMsgSource like the messages of every other kit: it is saved as .msg by Msg.Kit and as .eml by MIME.Kit, and compared with MAPI.Kit on the same mailbox the two kits give the same properties, recipients and attachments – recipients of the organization included, as EX + legacy DN like the store keeps them. The session signs in with the Windows credential of the user, so the program never sees a password; the EWS address comes from Autodiscover.Kit.

Delphi 13 Florence · Win32 and Win64 · Exchange Server 2016, 2019, Subscription Edition · SOAP over WinHTTP, the RTL’s XML DOM · no Outlook, no EWS Managed API, no .NET, no Indy · VCL-free

What EWS.Kit is for

  • Read an Exchange mailbox without Outlook: folders, messages, bodies, recipients, attachments and the MAPI properties, saved as .msg or .eml.
  • Send mail from the neutral TMailDraft or from MIME, reply, forward, move, copy, flag and categorise messages.
  • Calendars and meetings: the occurrences of a time window, recurrence, invitations, answers and cancellations, other users’ free/busy.
  • Contacts, private distribution lists, Outlook tasks, sticky notes and journal entries, read into and written from the same neutral records the other service kits use.
  • Keep a copy up to date: folder hierarchy and item synchronisation, pull and streaming subscriptions (no public endpoint needed).
  • Mailbox settings (automatic replies, inbox rules, master categories, working hours, delegates, mail tips) and the modern public folders with their Autodiscover routing.

How it is organised

  • EwsKit.Session – one identity on one server (the Windows credential, an explicit user name + password, or an OAuth token for hybrid servers), the SOAP headers, id conversion between EWS, MAPI and Graph; EwsOpenSession finds the EWS address with Autodiscover.
  • Mail: EwsKit.Folders, .Messages, .Attachments, .Writer, .Mailbox and .Source (the IMsgSource of an EWS message, with the legacy-DN resolver).
  • EwsKit.Calendar, .Contacts, .Tasks, .Notes, .Sync, .Settings, .PublicFolders, and EwsKit.MailboxSource – the whole mailbox behind the kit-neutral IMailboxSource a viewer is written against.
  • In the shared units: the SOAP client (faults, ErrorServerBusy / 503 / 504 retries, streamed answers), namespace-independent XML, the EWS names of the MAPI properties from the one property catalogue of the toolkit, the neutral write records TMailDraft, TAppointmentDraft, TContactDraft, TTaskDraft.
  • Clear rules: every date-time of the API is local time; a write needs the current change key (the kit refreshes one Exchange returns truncated); an error raises EEwsError with the response code; a write is never sent twice after a transport failure.

Getting started

A session through Autodiscover with the Windows credential, then the newest messages:

uses EwsKit, EwsKit.Session, EwsKit.Folders, EwsKit.Messages;

var
  Session: TEwsSession;
  List: TEwsMessages;
  M: TEwsMessage;
begin
  Session := EwsOpenSession('fred@contoso.com');   // EWS URL from Autodiscover
  List := TEwsMessages.Create(True);
  try
    FindMessages(Session, TEwsFolderId.Named('inbox'), TEwsMessageQuery.Newest(20), List);
    for M in List do
      Writeln(M.Subject, ' -- ', M.From.Address);
    Writeln(Session.ServerVersion.ToString);
  finally
    List.Free;
    Session.Free;
  end;
end;

The first message saved as .eml and .msg, then the next seven days of the calendar:

var
  Src: IMsgSource;
  Proxy: TMsgProxy;
  Items: TEwsCalendarItems;
  C: TEwsCalendarItem;
begin
  List[0].Load;   // every member, the attachments and the MAPI properties
  // recipients of the organization as EX + legacy DN, as Outlook keeps them
  Src := EwsMessageSource(List[0], False, EwsAutodiscoverResolver(Session));
  TFile.WriteAllBytes('first.eml', TMsgSourceMime.ToBytes(Src));
  Proxy := TMsgProxy.Create(Src);
  try
    Proxy.Save('first.msg');
  finally
    Proxy.Free;
  end;

  Items := TEwsCalendarItems.Create(True);
  try
    ReadCalendarView(Session, TEwsFolderId.Named('calendar'), Date, Date + 7, Items);
    for C in Items do
      Writeln(DateTimeToStr(C.StartTime), ' ', C.Subject);
  finally
    Items.Free;
  end;
end;

More examples, the rules of ownership, errors and time zones, and every class, property, method and routine are in the Class Reference and Developer Guide.

Part of the IMIBO mail toolkit

Every kit gives the same answer for the same message: the kits share one property catalogue, one message contract and one JSON property dump, so a message read by one kit can be written, converted or compared by any other.

MAPI.Kit · PST.Kit · Msg.Kit · MIME.Kit · Crypto.Kit · Autodiscover.Kit · Graph.Kit · EWS.Kit

EWS.Kit is developed by IMIBO; the source code is not public. For licensing, custom development or questions write to info@imibo.com.

EWS.Kit Class Reference and Developer Guide (PDF)

Pages of the EWS.Kit Class Reference and Developer Guide

EWS.Kit 1.00 – Class Reference and Developer Guide · PDF, 67 pages, English, October 2026. Introduction, requirements and rules, the units at a glance, getting started, the EWS.Kit guide (sessions and credentials, conventions, messages and IMsgSource, calendar, contacts, tasks and notes, synchronisation and notifications, mailbox settings, public folders, IMailboxSource), the class chapters, the neutral item models and the shared SOAP / XML layer.

The document is free. Enter your email address and you will receive a personal download link.

EWS.Kit Class Reference and Developer Guide – PDF, 67 pages, English, free.

Enter your email address and we will send you a personal download link (valid 72 hours).


Questions about EWS.Kit: info@imibo.com.

Example application: EWSInspectorLite (free download)

EWSInspectorLite iconEWSInspectorLite is a free, read-only viewer of on-premises Exchange mailboxes written with EWS.Kit – the same program as GraphInspectorLite with another data source: the accounts with their folder trees, the items of a folder page by page with sorting and server-side search (AQS), the MAPI properties, recipients and attachments of every item, messages with a safe HTML view (no scripts, external pictures blocked until you allow them), Save as .msg / .eml, calendars, contacts and Outlook tasks, light and dark themes. It signs in with your Windows credential (or a user name and password you type, optionally kept as a Windows credential), finds the server with Autodiscover and never changes the mailbox.

Screenshots

User guide

The guide of EWSInspectorLite, as it comes with the program (UserGuide.md in the ZIP). Open a section to read it.

EWSInspectorLite (EWSInspector Lite) is a read-only viewer of mailboxes on an on-premises Exchange server (Exchange Server 2016, 2019, Subscription Edition) through Exchange Web Services: the mail folders, the messages with their MAPI properties, recipients and attachments, the calendars, contacts and Outlook tasks. It is built on the IMIBO kits (EWS.Kit, Autodiscover.Kit, Msg.Kit, MIME.Kit, Shared) and has no third-party code. It never changes the mailbox.

It is the same program as GraphInspectorLite (the viewer of Microsoft 365 / Outlook.com through Microsoft Graph) with another data source: the windows, lists, panels and item windows are the shared viewer of Shared\Vcl\Inspector.

  • Windows 10 or 11 (64-bit or 32-bit build).
  • For HTML message bodies: the Microsoft Edge WebView2 runtime (part of Windows 11, installed with Edge on Windows 10) and WebView2Loader.dll next to EWSInspectorLite.exe (the build copies it there, see “Files”). Without them the bodies are shown as plain text.
  • An Exchange server whose EWS virtual directory (/EWS/Exchange.asmx) this computer reaches over https, with Windows authentication (Negotiate / NTLM) — the Exchange default. Exchange Online is not a target (EWS there is being retired): use GraphInspectorLite for Microsoft 365.
  • The server’s certificate must be trusted by Windows (a certificate of an internal CA: import the CA’s root certificate into “Trusted Root Certification Authorities” first). EWSInspector never ignores certificate errors.
  1. File > Add account… and type the e-mail address of the mailbox.
  2. Pick the credential:
    • Windows credential (the default): the Windows user you are signed in with (inside the organization’s domain), or the Windows credential saved in Credential Manager for the server (Control Panel > Credential Manager > Windows Credentials). EWSInspector never sees a password.
    • User name and password: e.g. DOMAIN\user or user@domain. With Remember in Windows Credential Manager (the default) the program saves them once as a Windows credential for the server and never reads the password back — the next start signs in with it like with any Windows credential. If the Credential Manager already holds a credential for that server, the program asks before it replaces it. Without “Remember” the password is kept in memory for this run only.
  3. The EWS address of the server is found by Autodiscover (Active Directory inside the domain, then the autodiscover.<domain> and <domain>/autodiscover addresses, DNS SRV). When Autodiscover finds nothing, tick Advanced: type the EWS URL and type it, e.g. https://mail.contoso.com/EWS/Exchange.asmx.
  4. Connect checks the connection in the background (the Inbox and the owner’s name; Cancel stops waiting) and shows the Exchange version, the EWS address and the mailbox owner. Add account keeps the account.
  5. The account appears in the tree, as “owner name <address>”.

File > Sign out of the selected account… removes the account from the list; a Windows credential the program saved for the server is removed too (one you saved yourself stays).

  • The tree (left): one root per account; under it the mail folders (Inbox, Sent Items, … with the unread count), then Calendars, Contacts and Tasks with every folder of that kind in the mailbox. Hidden system folders (Quick Step Settings, Recipient Cache, …) are not shown, as in Outlook. Folders are read when they are expanded.
  • The list (right): the items of the selected folder, with columns of its kind:
    • mail: From, Subject, Received, Size, Attachment, Flag, Importance — unread messages in bold;
    • calendar: Subject, Start, End, Location, Organizer, Recurring, All day (the stored items: a recurring series is one row, its master);
    • contacts: Name, Company, E-mail, Phone;
    • tasks: Title, Due, Completed, Status, Importance (Outlook tasks; Microsoft To Do lists exist only in Graph).

The list is read 50 items at a time in the background; the next 50 come when the last row scrolls into view. A click on a column header sorts the rows read so far (again: the other direction); Ctrl+C copies the selected rows.

  • Search (above the list): type words and press Enter — Exchange searches the whole folder (Advanced Query Syntax, as in Outlook’s search box: words, from:anna, subject:report, hasattachments:true, received:today, …); Esc clears it. Exchange searches through its content index: a message that is not indexed yet is not found.
  • View > Refresh (F5) reads the folder again.
  • The details panel (below the list, View > Details panel) shows the selected item — or, with no item selected, the folder itself; its title line says which (“Folder: Inbox”, “Message: <subject>”, “Event: …”). During a search it stays empty until a found item is selected (it says so), so nothing in it can be taken for a hit:
    • Properties: the MAPI properties — tag, canonical name, type, value, description; for a message every property EWS.Kit reads, recipients of the organization as the store keeps them (EX + the legacy DN, found with Autodiscover); a tooltip on a property tells what the property catalog knows of it (description, tag / ID / type, area, property set and LID / name of a named property, other names); a double click, Enter or Property details… in the context menu opens the property window — that information, the whole value and its bytes as a hexadecimal or binary dump;
    • Recipients: kind (To, Cc, Bcc, …), name, address;
    • Attachments: name, size, type, kind; Save as… / Save all to a folder… from the context menu, a double click saves one. With a folder selected, the status bar gives its number of items and unread items and of its properties.

A double click (or Enter) on a row opens it in its own window; several windows can be open at once.

  • A message: From, To, Cc, Date, Subject; the attachments (inline pictures are shown in the body, not listed); Save as .msg (an Outlook message file) and Save as .eml (an Internet message). The body is shown safely:
    • no scripts run, and nothing is loaded from the network — pictures that are part of the message are shown;
    • when the message refers to pictures or styles on the internet (newsletters, tracking pixels), a bar says “External pictures and styles are blocked to protect your privacy”; Show external content loads them for this message (still without scripts);
    • a link opens in your default browser, never inside EWSInspector.
  • An event, a contact or a task: the fields that are set (times, time zone, recurrence in words, attendees, reminder, addresses, phones, status, …) and the description / notes below them.

View > Theme: System (the default — follows Windows’ light / dark app mode, also while the program runs), Light or Dark. The icons follow the theme.

What Where
The accounts (address, name, credential kind, EWS address, user name — never a password) %LOCALAPPDATA%\IMIBO\EWSInspector\accounts.json
The theme setting %LOCALAPPDATA%\IMIBO\EWSInspector\settings.json
A remembered user name + password Windows Credential Manager > Windows Credentials, the server’s name (comment “Saved by EWSInspector”)
The WebView2 profile (cache of the body view) %LOCALAPPDATA%\IMIBO\EWSInspector\WebView2
A shown HTML body (while its window is open) %TEMP%\EWSInspector-<guid>.html (deleted on close)
WebView2Loader.dll next to EWSInspectorLite.exe (from Shared\Vcl\Inspector\redist\WebView2.<platform>)
  • EWSInspector\EWSInspectorLite.dproj (Win64 / Win32), search path ..\Shared;..\Shared\Vcl;..\Shared\Vcl\Inspector; ..\EWS.Kit;..\Autodiscover.Kit;..\Msg.Kit;..\MIME.Kit — no third-party code. The program’s own units are EWSInspectorLite.dpr, EwsInspector.Backend (the EWS data source of the viewer) and EwsInspector.SignIn (the Add account dialog); the viewer is Shared\Vcl\Inspector. The post-build event copies the platform’s WebView2Loader.dll (Microsoft’s NuGet package Microsoft.Web.WebView2, see Shared\Vcl\Inspector\redist\README.md) next to the exe.
  • Optional: the conditional define HTMLVIEWER (with $(HtmlViewer)\source on the search path) shows HTML bodies in THtmlViewer when WebView2 is not available — the one third-party component, opt-in.
  • Read-only: nothing is sent, moved, deleted or changed (reading a message does not mark it as read).
  • What EWS does not return is not shown: EWS.Kit reads the stored MAPI properties of its property list, no computed ones.
  • Public folders, other users’ mailboxes (delegate access, impersonation) and OAuth sign-in (hybrid servers) are not in the Lite version.

The download (ZIP, 6.6 MB) contains:

  • Win64\EWSInspectorLite.exe and Win32\EWSInspectorLite.exe – the program, no installation (with Microsoft’s WebView2Loader.dll next to it).
  • Source\ – the complete source code of EWSInspectorLite and of the viewer it shares with GraphInspectorLite (Delphi 13, VCL): the project, its units and forms, the icon.
  • UserGuide.md and README.txt.

Note: The ZIP holds the executable and the source code of the program, but not the libraries it is built on – EWS.Kit, Autodiscover.Kit, the shared units, Msg.Kit and MIME.Kit; to compile the source you need those kits.

Enter your email address and you will receive a personal download link.

EWSInspectorLite – ZIP, 6.6 MB: the program (64-bit and 32-bit) and its source code, without the kits it is built on, free.

Enter your email address and we will send you a personal download link (valid 72 hours).


Questions about EWSInspectorLite: info@imibo.com.

Intelligence Management Interface BackOffice - IMIBO - Logo

Copyright © 2026 IMIBO. Privacy Statement