MAPI.Kit for Delphi – Examples
MAPI.Kit Beginner Examples
Eight console programs with the basics of MAPI.Kit: is MAPI usable, how errors arrive, a logon, the stores, a .pst file without Outlook, the folder tree, reading a message, saving attachments, writing a draft and the properties underneath. Console programs keep the MAPI.Kit code in plain view, with no user interface around it. They work on a copy of the examples’ test store unless a .pst file or --profile is given, and the examples that write create a .pst file of their own.
Download all 8 beginner examples
All 8 examples, compiled and signed (Win32 and Win64)
Source code of all 8 examples (Delphi 10.3 Rio – Delphi 13 Florence)
The source code needs the MAPI.Kit library: it comes in the free DCU packages, one per Delphi version.
The examples
Example #1 – Check the MAPI environment and handle MAPI errors
Can this program use MAPI (32/64-bit), the installed Outlook, the MAPI profiles, a failed MAPI call as an EMAPIError.
Example #2 – Log on to a profile and list its message stores
A logon to the default or a named profile, the store table, the typed store classes.
Example #3 – Read a .pst file without Outlook
The “Getting Started” program: a .pst file opened without a profile, the ten newest messages of every folder.
Example #4 – The folder tree of a message store
The well-known folders and the folder tree from the rows of the hierarchy table.
Example #5 – Read the Inbox: the message list and one message
The contents table, sorting, a message opened: header, recipients, body, attachments.
Example #6 – Save the attachments of messages
File attachments saved to disk, a look into embedded messages.
Example #7 – Create a draft: recipients, HTML body, attachments
A new message with recipients, an HTML body and attachments, saved and read back.
Example #8 – Read, write and delete raw MAPI properties
Raw property access, a missing property, deleting a property, all properties of an object.
