PMAPIWrapper - Helper dll to access Outlook properties without security prompts Print E-mail

PMAPIWrapper is a COM library based on the MAPIProp library. It has been extended to provide the extra functionality needed to avoid security prompts in Outlook versions prior to 2007.

Complete list of functions:

Required to initialise the library (called after instantiating PMAPILib object).

Must be called before releasing the object.

GetOneProp(OutlookItem, Property) As String
Returns the given property for the Outlook item (the property being a MAPI constant, e.g. PR_TRANSPORT_MESSAGE_HEADERS).

ReadStreamProp(OutlookItem, Property) As String
Same as GetOneProp but for Outlook stream properties (e.g. PR_BODY).

As above but used to read RTF stream e.g. PR_RTF_COMPRESSED.

GetOutlookProfileName() as String
Returns the name of the currently active Outlook profile.This wasn't included due to security prompts, but the only other way of obtaining the currently active profile is CDO.  CDO is no longer support by Microsoft.

GetRecipientList(MailItem, String()) As Integer
Returns the number of recipients in the email, and populates the given string array with their SMTP email addresses.

GetContactEmail1(ContactItem) As String
Returns Email1Address when passed a Contact object.

GetContactEmailAll(ContactItem, String()) As Integer
Returns all the email addresses associated with a contact as a string array.

GetSenderSMTP(MailItem) As String
Returns the sender SMTP address.  This function also works with Exchange, which by default returns an X500 address.  If an X500 address is returned, then the corresponding SMTP address is queried.  This function will always return an SMTP address.

DeleteMessage(OutlookItem, OutlookFolder) As String
Deletes the given item without sending it to the Deleted Items folder (which is what the Delete option in the OOM does).  Returns "SUCCESS" if successful, otherwise returns error reason.  OutlookFolder must be the folder containing the item.

GetProfileEmailAddresses (String()) As Integer
Returns the number of email addresses in the current profile, and fills the passed array with the email address values.

GetCurrentProfileName() as string
Returns the name of the currently loaded profile.

EnumerateFolders(OutlookFolder, FolderArray) as string
Returns an array of the names of all the folders and subfolders of the given OutlookFolder.  Depending upon the bounds of the array, this function also returns default item type, parent folder path (relative to OutlookFolder) and parent id (the id of the array item that is the parent - useful for creating a treeview from the array).


The library basically enables a VB developer (for example) to access most properties without needing to worry about the security model.  If further features are required, you'd be advised to use Redemption.  PMAPIWrapper is a much cheaper alternative for those not requiring the full features of such a library, or wanting to avoid learning RDO.  The advantage of this library is it's size (it is less than 100k) and that it is designed specifically to return the above properties back to VB in readily useable formats.

Purchase of this library allows the licensee to use and distribute the library with any applications they develop.

Please contact me if you want to purchase this library - it is available for £14.99.

Copyright © 2009 All rights reserved.