Working with MAPI Properties

Accessing and Setting Outlook MAPI Property

The MapiProperty class represents a MAPI property, which contains:

  • Name: a string that represents the name property.
  • Tag: a long type value that represents the tag property .
  • Data: a byte array which represents the data property.

Get MAPI Properties Using Property Tags

To get MAPI properties:

  1. Create an instance of MapiMessage by loading from files or stream.
  2. Get the MapiProperty from MapiMessage.Properties by MapiPropertyTag keys.

The following code snippet shows you how to get MAPI property using the MAPI property tag.

Set MAPI Properties

The following code snippet shows you how to set MAPI properties.

where the definition of convertDateTime method is as follows:

Additional Properties

The following code snippet shows you how to set additional MAPI properties.

Read Named MAPI Properties from MSG Files

The following code snippet shows you how to read named MAPI properties from the MSG file.

Read Named MAPI Properties from Attachments

Aspose.Email also allows you to traverse through the properties of a MapiAttachment and search for a named property, in a way similar to the example above, for MapiMessage. The following code snippet shows you how to search for a named property through the attachment property collection.

Remove Properties from MSGs and Attachments

The following code snippet shows you how to remove properties from MSGs and attachments.