LazyMAPI

The TMAPIStore - Delphi wrapper object for IMsgStore.

unit: MAPIStore.pas
file path: ..\Library\Helpers
version: 2014.хх
uses
Windows, Types, SysUtils, ExtendedMAPI, EDK, IMIEMTypes, MAPITable, MAPIProperty, MAPIFolder;

 

Unit: MAPIStore.pas
Type: Class
Inherited from: TMAPICustomHolder
 
 
TMAPIStore = class(TMAPICustomHolder)
  private
    ... 
  protected
    ...
    ...
  public
    constructor Create(const oStore: IMsgStore); reintroduce;
    destructor Destroy; override;
 
    property AccessLevel;
    property EntryID;
    property StoreID;
    property StoreSupportMask;
    property IsSupportsUnicode;
    property Signature;
    property SearchKey;
    property ProviderID;
    property RecordKey;
    property MAPISession;
    property MAPIObject;
    property Folders;
 
    property NoCache;
    property Active;
    property MAPIObjType;
    property Modified;
    property PropertyTags;
 
    property Comment: String Read GetComment Write SetComment;
    property DisplayName: String read GetDisplayName write SetDisplayName;
 
    property IsPublic: Boolean Read GetIsPublic;
    property IsExchange: Boolean Read GetIsExchange;
    property IsExchangePrimary: Boolean Read GetIsExchangeUser;
    property IsExchangeShared: Boolean read GetIsExchangeShared;
    property IsExchangePublic: Boolean read GetIsExchangePublic;
 
    property RootFolder: TMAPIFolder read GetRootFolder;
    property TopFolder: TMAPIFolder read GetTopFolder;
    property StoreType: TStoreType read GetStoreType;
    property CommonViewsEntryId: TBytes read GetCommonViewsEntryId;
    property ValidFolders: TValidFolders read GetValidFolders;
    property DefaultFolder[const FldType: TMAPIFldType]: TMAPIFolder read GetSpecialFolder;
 
    property AllowEvents: Boolean read FAllowEvents write SetAllowEvents;
    property StoreEvents: TMAPIEvents read FStoreEvents write FStoreEvents;
 
    property OnCriticalError: TCriticalErrorEvent read FOnCriticalErrorEvent write FOnCriticalErrorEvent;
    property OnNewMailEvent: TNewMailEvent read FOnNewMailEvent write FOnNewMailEvent;
    property OnBasicObjectEvent: TObjBasicEvent read FOnBasicObjectEvent write FOnBasicObjectEvent;
 
    function CompareEntryIDs(const EntryID1, EntryID2: TBytes): Boolean;
    function GetObject(const aEntryID: TBytes; const AccessLevel: TAccessLevel = alBestAccess): TMAPIProperty;
    function GetFolderType(const aEntryID: TBytes): TMAPIFldType;
    function GetSpecialFolderEntryID(const FolderType: TMAPIFldType): TBytes;
  end;
 
 
 
TMAPIEventType = (evCriticalError, evNewMail, evObjectCreated, evObjectDeleted, evObjectModified, evObjectMoved, evObjectCopied, evSearchComplete);
 
Name Description
evCriticalError Registers for notifications about severe errors, such as insufficient memory.
evNewMail Registers for notifications about the arrival of new messages.
evObjectCreated Registers for notifications about the creation of a new folder or message.
evObjectDeleted Registers for notifications about a folder or message being deleted.
evObjectModified Registers for notifications about a folder or message being modified.
evObjectMoved Registers for notifications about a folder or message being moved.
evObjectCopied Registers for notifications about a folder or message being copied.
evSearchComplete Registers for notifications about the completion of a search operation.
 
TMAPIEvents = Set of TMAPIEventType;
 
TCriticalErrorEvent = procedure(Sender: TObject; EntryID: TBytes; ErrorCode: HRESULT; ErrorMessage: string) of object;
TNewMailEvent = procedure(Sender: TObject; EntryID: TBytes; ParentID: TBytes; MessageClass: string; MessageFlags: ULONG) of object;
TObjBasicEvent = procedure(Sender: TObject; EventType: TMAPIEventType; MAPIObjType: TMAPIObjType; EntryID: TBytes; ParentID: TBytes; OldID: TBytes;
  OldParentID: TBytes; Tags: array of ULONG) of object;

Constructors

Name Description
Create Creates and initializes object instance from IMsgStore

constructor Create(const oStore: IMsgStore); reintroduce;

Properties

Name Access Type Description
AccessLevel RO TAccessLevel

Indicates the client's access level to the MAPI object (PR_ACCESS_LEVEL)

EntryID RO TBytes Contains a MAPI entry identifier - PR_ENTRYID
StoreID RO TBytes Contains the unique entry identifier of the message store where an object reside -   PR_STORE_ENTRYID
StoreSupportMask RO TStoreSupportsSet Indicates the capabilities of a message store to client applications  (PR_STORE_SUPPORT_MASK)
IsSupportsUnicode RO Boolean Indicates that the message store supports Unicode storage.
Signature RO TBytes Contains the mapping signature for named properties (PR_MAPPING_SIGNATURE)
SearchKey RO TBytes Contains a binary-comparable key that identifies correlated objects for a search (PR_SEARCH_KEY)
ProviderID RO TBytes Contains a provider-defined MAPIUID structure that indicates the type of the message store. (PR_MDB_PROVIDER)
RecordKey RO TBytes Contains a unique binary-comparable identifier (PR_RECORD_KEY)
MAPISession RO IMAPISession Inherited from TMAPIBase
MAPIObject RO IMAPIProp Inherited from TMAPIProperty
Folders RO TMAPIFolders Inherited from TMAPICustomHolder
NoCache RW Boolean Inherited from TMAPICustomHolder
Active RW Boolean Inherited from TMAPIProperty
MAPIObjType RO TMAPIObjType Inherited from TMAPIBase
Modified RO Boolean Inherited from TMAPIProperty
PropertyTags RW TCardinalDynArray Inherited from TMAPIProperty
PropFields RO TMAPIPropFields Inherited from TMAPIProperty
Comment RW String  Contains a comment about the purpose or content of an object (PR_COMMENT)
DisplayName RW String Contains the display name for a given MAPI object.  (PR_DISPLAY_NAME)
IsPublic RO Boolean The folders in this store are public (multi-user), not private
IsExchange RO Boolean This store is managed by Microsoft Exchange Server
IsExchangePrimary RO Boolean This store is managed by Microsoft Exchange Server, and it is the primary private (Mailbox) store.
IsExchangeShared RO Boolean This store is managed by Microsoft Exchange Server, and it is an additional (delegate/shared) store.
IsExchangePublic RO Boolean This store is managed by Microsoft Exchange Server, and it is public (multi-user), not private
RootFolder RO TMAPIFolder Returns TMAPIFolder representing the root folder of the message store. This folder is not visible. There is only one root folder for each message store. The root folder appears at the top of the hierarchy and contains messages and other folders.
TopFolder RO TMAPIFolder Returns TMAPIFolder representing "Top of Information Store" (IPM_SUBTREE). This folder is not visible. An IPM subtree for a delivery store consists of at least the following folders: Inbox, Outbox, Sent Items, Deleted Items
StoreType RO TStoreType Identifies type of MAPI Message Store
CommonViewsEntryId RO TBytes The entry identifier for the common view folder (PR_COMMON_VIEWS_ENTRYID)
ValidFolders RO TValidFolders Contains a set of flags that indicate the validity of the entry identifiers of the folders in a message store.
DefaultFolder RO TMAPIFolder Passing index (TMAPIFldType) returns default folder for a message class (Inbox, Contacts, Notes, Journal, etc..)
AllowEvents RW Boolean Specifies whether the processing of events to be enabled. If they are allowed, then they can be captured by the processing of events such as NewMail, ObjectCreated, etc..
StoreEvents RW TMAPIEvents Returns/Specifies which events can be processed.

Methods

Name Description
CompareEntryIDs Checks whether the two entry ids refer to the same MAPI object.

function CompareEntryIDs(const EntryID1, EntryID2: TBytes): Boolean;
GetObject Returns TMAPIFolder/TMAPIMessage object.

function GetObject(const aEntryID: TBytes; const AccessLevel: TAccessLevel = alBestAccess): TMAPIProperty;
GetFolderType Returns FolderType (Inbox, Contacts, Deleted Items, etc..) from its EntryID

function GetFolderType(const aEntryID: TBytes): TMAPIFldType;
GetSpecialFolderEntryID Returns the EntryID for "special folder" as inbox, outbox, contacts, etc...

function GetSpecialFolderEntryID(const FolderType: TMAPIFldType): TBytes;

Events

Name Type Description
OnCriticalError TCriticalErrorEvent Notifications about severe errors, such as insufficient memory.
OnNewMailEvent TNewMailEvent Notifications about the arrival of new messages.
OnBasicObjectEvent TObjBasicEvent Notifications about evObjectCreated, evObjectModified, evObjectDeleted, evObjectMoved, evObjectCopied, evSearchComplete

Top


TMAPIExchangeStore = class(TMAPIStore)
  public
    property AccessLevel;
    property EntryID;
    property StoreID;
    property StoreSupportMask;
    property IsSupportsUnicode;
    property Signature;
    property SearchKey;
    property ProviderID;
    property RecordKey;
    property MAPISession;
    property MAPIObject;
    property Folders;
 
    property NoCache;
    property Active;
    property MAPIObjType;
    property Modified;
    property PropertyTags;
 
    property Comment;
    property DisplayName;
 
    property IsPublic;
    property IsExchangePrimary;
    property IsExchangeShared;
    property IsExchangePublic;
    property CodePageId;
    property ContentCount;
    property ContentCountAssoc;
    property MessagesSize;
    property LocaleId;
    property SortLocaleId;
    property IsOnline;
  end;

Properties

Name Access Type Description
AccessLevel RO TAccessLevel

Indicates the client's access level to the MAPI object (PR_ACCESS_LEVEL)

EntryID RO TBytes  Contains a MAPI entry identifier - PR_ENTRYID
StoreID RO TBytes Contains the unique entry identifier of the message store where an object reside -   PR_STORE_ENTRYID
StoreSupportMask RO TStoreSupportsSet Indicates the capabilities of a message store to client applications  (PR_STORE_SUPPORT_MASK)
IsSupportsUnicode RO Boolean Indicates that the message store supports Unicode storage.
Signature RO TBytes Contains the mapping signature for named properties (PR_MAPPING_SIGNATURE)
SearchKey RO TBytes Contains a binary-comparable key that identifies correlated objects for a search (PR_SEARCH_KEY)
ProviderID RO TBytes Contains a provider-defined MAPIUID structure that indicates the type of the message store. (PR_MDB_PROVIDER)
RecordKey RO TBytes Contains a unique binary-comparable identifier (PR_RECORD_KEY)
MAPISession RO IMAPISession Inherited from TMAPIBase
MAPIObject RO IMAPIProp Inherited from TMAPIProperty
Folders RO TMAPIFolders Inherited from TMAPICustomHolder
NoCache RW Boolean Inherited from TMAPICustomHolder
Active RW Boolean Inherited from TMAPIProperty
MAPIObjType RO TMAPIObjType Inherited from TMAPIBase
Modified RO Boolean Inherited from TMAPIProperty
PropertyTags RW TCardinalDynArray Inherited from TMAPIProperty
PropFields RO TMAPIPropFields Inherited from TMAPIProperty
Comment RW String  Contains a comment about the purpose or content of an object (PR_COMMENT)
DisplayName RW String Contains the display name for a given MAPI object.  (PR_DISPLAY_NAME)
IsPublic RO Boolean The folders in this store are public (multi-user), not private
IsExchange RO Boolean This store is managed by Microsoft Exchange Server
IsExchangePrimary RO Boolean This store is managed by Microsoft Exchange Server, and it is the primary private (Mailbox) store.
IsExchangeShared RO Boolean This store is managed by Microsoft Exchange Server, and it is an additional (delegate/shared) store.
IsExchangePublic RO Boolean This store is managed by Microsoft Exchange Server, and it is public (multi-user), not private
RootFolder RO TMAPIFolder Returns TMAPIFolder representing the root folder of the message store. This folder is not visible. There is only one root folder for each message store. The root folder appears at the top of the hierarchy and contains messages and other folders.
TopFolder RO TMAPIFolder Returns TMAPIFolder representing "Top of Information Store" (IPM_SUBTREE). This folder is not visible. An IPM subtree for a delivery store consists of at least the following folders: Inbox, Outbox, Sent Items, Deleted Items
StoreType RO TStoreType Identifies type of MAPI Message Store
CommonViewsEntryId RO TBytes The entry identifier for the common view folder (PR_COMMON_VIEWS_ENTRYID)
ValidFolders RO TValidFolders Contains a set of flags that indicate the validity of the entry identifiers of the folders in a message store.
DefaultFolder RO TMAPIFolder Passing index (TMAPIFldType) returns default folder for a message class (Inbox, Contacts, Notes, Journal, etc..)
AllowEvents RW Boolean Specifies whether the processing of events to be enabled. If they are allowed, then they can be captured by the processing of events such as NewMail, ObjectCreated, etc..
StoreEvents RW TMAPIEvents Returns/Specifies which events can be processed.
CodePageId RO ULONG Contains the identifier for the client code page used for Unicode to double-byte character set (DBCS) string conversion. (PR_CODE_PAGE_ID)
ContentCount RO ULONG Contains the number of messages in a folder, as computed by the message store. (PR_CONTENT_COUNT)
ContentCountAssoc RO ULONG Contains the count of items in the associated contents table of the folder. (PR_ASSOC_CONTENT_COUNT)
MessagesSize RO Int64 Contains the sum, in bytes, of the sizes of all properties on all message objects. (PR_MESSAGE_SIZE_EXTENDED)
LocaleId RO ULONG stablishes the language locale for translating system-generated messages, such as delivery reports. (PR_LOCALE_ID)
SortLocaleId RO ULONG Contains the locale identifier. (PR_SORT_LOCALE_ID)
IsOnline RO Boolean Indicates whether the server connection is direct or offline (PR_STORE_OFFLINE)

Top


  TMAPIExchangePublicStore = class(TMAPIExchangeStore)
  end;

Top


TMAPIExchangePrivateStore = class(TMAPIExchangeStore)
  public
    property Inbox;
    property Outbox;
    property SentItems;
    property TrashBox;
 
    property Calendar;
    property Contacts;
    property Drafts;
    property Journal;
    property Notes;
    property Tasks;
    property Junk;
 
    property RSSFeeds;
    property SearchRoot;
    property SyncIssuesFolder;
 
    property FolderConflicts;
    property FolderLocalFailures;
    property FolderServerFailures;
  end;

Properties

Name Access Type Description
Inbox RO TMAPIFolder The Inbox folder
Outbox RO TMAPIFolder The standard interpersonal message (IPM) Outbox folder.
SentItems RO TMAPIFolder  The standard interpersonal message (IPM) Sent Items folder.
TrashBox RO TMAPIFolder The standard interpersonal message (IPM) Deleted Items folder.
Calendar RO TMAPIFolder The Outlook Calendar folder.
Contacts RO TMAPIFolder The Outlook Contacts folder.
Drafts RO TMAPIFolder The Outlook Drafts folder
Journal RO TMAPIFolder The Outlook Journal folder.
Notes RO TMAPIFolder The Outlook Notes folder.
Tasks RO TMAPIFolder The Outlook Tasks folder.
Junk RO TMAPIFolder The Outlook Junk E-mail Folder
RSSFeeds RO TMAPIFolder The Outlook RSS Feeds folder.
SearchRoot RO TMAPIFolder The folder where search results are typically created.
SyncIssuesFolder RO TMAPIFolder The Outlook Sync Issues folder
FolderConflicts RO TMAPIFolder The Outlook Conflicts folder (subfolder of SyncIssuesFolder).
FolderLocalFailures RO TMAPIFolder The Outlook Local Failures folder (subfolder of SyncIssuesFolder).
FolderServerFailures RO TMAPIFolder The Outlook Server Failures folder (subfolder of SyncIssuesFolder).

Top


  TMAPILocalPersonalStore = class(TMAPIStore)
  private
  public
    property Inbox;
    property Outbox;
    property SentItems;
    property TrashBox;
 
    property Calendar;
    property Contacts;
    property Drafts;
    property Journal;
    property Notes;
    property Tasks;
    property Junk;
 
    property RSSFeeds;
    property SearchRoot;
    property SyncIssuesFolder;
 
    property FileLocation: string read GetStorePath;
  end;

Properties

Name Access Type Description
Inbox RO TMAPIFolder The Inbox folder
Outbox RO TMAPIFolder The standard interpersonal message (IPM) Outbox folder.
SentItems RO TMAPIFolder  The standard interpersonal message (IPM) Sent Items folder.
TrashBox RO TMAPIFolder The standard interpersonal message (IPM) Deleted Items folder.
Calendar RO TMAPIFolder The Outlook Calendar folder.
Contacts RO TMAPIFolder The Outlook Contacts folder.
Drafts RO TMAPIFolder The Outlook Drafts folder
Journal RO TMAPIFolder The Outlook Journal folder.
Notes RO TMAPIFolder The Outlook Notes folder.
Tasks RO TMAPIFolder The Outlook Tasks folder.
Junk RO TMAPIFolder The Outlook Junk E-mail Folder
RSSFeeds RO TMAPIFolder The Outlook RSS Feeds folder.
SearchRoot RO TMAPIFolder The folder where search results are typically created.
SyncIssuesFolder RO TMAPIFolder The Outlook Sync Issues folder
FileLocation RO string Returns a fully qualified path to the given PST store
Copyright © 2021 IMIBO
Privacy Statement