You are here: Home / Developer Tools / MAPIProp


This is a free COM-component designed to read the MAPI-properties of CDO and Microsoft Outlook Object Model objects for Microsoft Outlook 2000, 2002/XP, 2003, 2007, 2010. The component has no limitation on the data size stored in a property and it supports work with compressed properties (like PR_RTF_COMPRESSED). Usage of MAPI-properties allows one to avoid Microsoft Outlook security system prompts on the retrieval of a message sender address, message body, etc., whilst working in Visual Basic and script languages like JScript and VBScript.

The component is supplied with the source code in Microsoft Visual C++ 6.0 and examples in Visual Basic .NET, Visual Basic 6.0 and Jscript.

The component can be used to do the following:

  1. Getting object properties without security system prompts
  2. Getting properties unavailable through the Microsoft Outlook object model, e.g. Internet headers of a message
  3. Getting properties not available through Microsoft Outlook object model, e.g. message body is varied presentation modes (RTF, HTML, text)

For detailed guidance on how to work with MAPI-properties, see the article "How to avoid security prompts in Visual Basic programs for Outlook", we strongly recommend that you get familiar with it before you start using the component.

The component methods:

	VARIANT pObject,
	long propTag,
	VARIANT* result);
HRESULT ReadStreamProp(
	VARIANT pObject,
	long propTag,
	BSTR* result);
HRESULT ReadRTFStreamProp(
	VARIANT pObject,
	long propTag,
	BSTR* result);
HRESULT Initialize();
HRESULT Uninitialize();
Visual Basic:
Function GetOneProp ( _
	pObject As Object, _
	propTag As Long) As Variant
Function ReadStreamProp ( _
	pObject As Object, _
	propTag As Long) As String
Function ReadRTFStreamProp ( _
	pObject As Object, _
	propTag As Long) As String
Sub Initialize()
Sub Uninitialize()


Returns the value of a property of CDO object or Microsoft Outlook object model. For example, a message is represented by a Message object in CDO, and by MailItem in the Microsoft Outlook object model. You can pass any of the two objects to the method. No matter what object you have passed, you can use CDO constants like CdoPR_SENDER_EMAIL_ADDRESS as the propTag value (MAPI property tag).


The method is designed to read property values of great volume like CdoPR_BODY or PR_HTML (text and HTML forms of the message presentation) as a string. This method is used because MAPI utilizes another approach to read large-volume properties (i.e. the property is opened and read through a stream).


This method works like the previous one, but in addition it provides for stream decompression. For example, RTF-presentation of a message body is stored in compressed form (PR_RTF_COMPRESSED), as if you try to read it through ReadStreamProp you will get an array of binary data instead of text.

Initialize and Uninitialize

These two methods provide for the initialization and de-initialization of the MAPI library. If CDO is used, MAPI is initialized by the Logon method call in a CDO session, so these functions are unnecessary. If you are developing an add-in for Outlook, MAPI is usually already initialized by Outlook itself before you invoke your add-in, so you can do without invoking those functions (though invoking them wouldn’t do any harm).

With Outlook automation (Outlook.Application object creation), MAPI often is not initialized even upon execution of the following code (don't confuse this with the Logon call in CDO session):

Set olApp = New Outlook.Application
Set olNameSpace = _

So the call of the Initialize function is necessary for the proper operation of the component.

The component limitations

  1. The component only works with object properties, and it is unable of working with it's tables (e.g. with message attachment tables)
  2. The component doesn't support operation with multi-valued properties (e.g., like PT_MV_BINARY). However, there are no such properties amongst CDO constants.
  3. When reading properties through ReadStreamProp and ReadRTFStreamProp, the result is always returned as a string, no matter what the property type is.

Component usage examples

The component is supplied with the source code in Microsoft Visual C++ 6.0 and examples in Visual Basic .NET, Visual Basic 6.0 and JScript. All the examples are both for CDO and for Microsoft Outlook Object Model.

Ordering Information

MAPIProp is free for commercial and non-commercial use.
Download MAPIProp Download MAPIProp (128 KB):
 Primary Download
 Secondary Download
Leave your Suggestion:
The Website uses cookies that allow us to recognize you and collect information about your user experience.

Permission to use cookies necessary for the use of the Site and its services, including ordering services. By visiting the site, we are sure that you consent to the use and storage of cookies on your device. If you agree, continue to use the site. If not – set special settings in your browser or contact technical support.