Working with MAPI Properties
Setting and Accessing Outlook MAPI Properties
Aspose.Email for Java provides the MapiProperty class that represents a MAPI property:
- Name: the property name.
- Tag: the property’s tag.
- Data: the property data.
This topic also discusses how to set and access an Outlook Message (MSG) file’s MAPI properties using Aspose.Email for Java. In addition, a sample code has been provided about how to remove properties from MSGs and Attachments.
To read data of MAPI properties from an MSG file:
- Create an instance of the MapiMessage class to load an MSG file using the fromFile() static method.
- Set a reference to the MapiMessage object’s getProperties() method to get the MapiPropertyCollection.
- Get the MapiProperty object from the MapiPropertyCollection by the MapiPropertyTag keys.
- Get the property data using an appropriate getXXX() method.
Set Additional Properties
The following code sample can be used to set additional properties of an Outlook MapiMessage.
Reading Named Mapi Properties from Email Messages
Microsoft Outlook supports adding named MAPI properties to an MSG file. These properties are added by the user. Developers can add a named property, for example “MyProp”, to an MSG file using Aspose.Email.