MAPI (also known as Extended MAPI) is a powerful and complex COM-based API developed for creating mail-enabled applications. Microsoft Outlook and Exchange are among the most popular applications utilizing MAPI. Add-in Express provides Outlook developers with a free component, MAPI Store Accessor, that hides MAPI complexities to provide developers with easy access to MAPI features. One of them is hidden items.
Hidden items in Extended MAPI
Storing some application-specific data between sessions is quite a usual task for Outlook developers. Such data are store either in the Windows registry or just in a file (binary or text, custom format or XML).
The MAPI subsystem provides yet another possibility: it allows you to create and save any data in hidden items. As the name suggests, a hidden item isn’t visible in Outlook. Hidden items are similar to usual mail, contact, and task items because they have the same properties: subject, body, attachments, etc. Also, you can find the term “associated content” in various information sources which has exactly the same meanings.
As an example of this approach, Outlook saves folder view settings in hidden items. Views, custom form definitions, archive settings, and many other configuration options can be stored in such hidden items. In Outlook 2007, you can find the StorageItem class that describes a hidden item.
MAPI Store Accessor provides an easy access to this feature of MAPI through the HiddenMapiItems property of the AddinExpress.MAPI.Folder class. To demonstrate the use of this property, I developed a small application that creates a new MAPI session for the default MAPI profile and show the following form:

The form allows choosing a folder name in order to see its hidden items. In the list box, I show the subject and the class name of hidden items. You can download the source code of the Hidden Outlook Items via Extended MAPI sample in VB.NET and in C#.
You can create such an item and use standard and / or custom properties to store your data.
To set a value of some standard property in the SetProperty method, you use the corresponding property tag from the AddinExpress.MAPI.ADXMAPIPropertyTag enumeration.
To create a custom property you have to combine a property type with a property ID into the property tag. For example, consider the following code:
C#:
mapiItem.SetProperty(0x340F0003, myLongValue);
VB.NET:
mapiItem.SetProperty(CType(&H340F0003, UInteger), myLongValue)
The first parameter of the SetProperty method is a property tag. The first part of the property tag is a property ID (0×340F) and the second one is a property type. In this case the property type is PT_LONG (0×0003).
Extended MAPI allows you to choose an ID for your custom property from the predefined ranges of values. The ranges are listed in the MAPITags.h file. Here they are:
The following ranges should be used for all property IDs. Note that property IDs for objects other than messages and recipients should all fall in the range 0×3000 to 0×3FFF:
| From | To | Kind of property |
| 0001 | 0BFF | MAPI_defined envelope property |
| 0C00 | 0DFF | MAPI_defined per-recipient property |
| 0E00 | 0FFF | MAPI_defined non-transmittable property |
| 1000 | 2FFF | MAPI_defined message content property |
| 3000 | 3FFF | MAPI_defined property (usually not message or recipient) |
| 4000 | 57FF | Transport-defined envelope property |
| 5800 | 5FFF | Transport-defined per-recipient property |
| 6000 | 65FF | User-defined non-transmittable property |
| 6600 | 67FF | Provider-defined internal non-transmittable property |
| 6800 | 7BFF | Message class-defined content property |
| 7C00 | 7FFF | Message class-defined non-transmittable property |
| 8000 | FFFE | User-defined Name-to-id mapped property |
The 3000-3FFF range is further subdivided as follows:
| From | To | Kind of property |
| 3000 | 33FF | Common property such as display name, entry ID |
| 3400 | 35FF | Message store object |
| 3600 | 36FF | Folder or Adderess Book container |
| 3700 | 38FF | Attachment |
| 3900 | 39FF | Address book object |
| 3A00 | 3BFF | Mail user |
| 3C00 | 3CFF | Distribution list |
| 3D00 | 3DFF | Profile section |
| 3E00 | 3FFF | Status object |
Find more about MAPI property tags on MSDN.
Eugene Astafiev
Add-in Express Team




