MapiProperty

Overview

MapiProperty is the fundamental unit of MAPI data storage. Every piece of structured data in an MSG file — subject, body, timestamps, sender information — is stored as a MapiProperty. The property_tag combines the 16-bit property ID and 16-bit type code into a single 32-bit integer. Instances are returned by MapiMessage.get_property(), set_property(), and the equivalent methods on MapiRecipient and MapiAttachment.

from aspose.email_foss import msg

message = msg.MapiMessage.create("Test", "Body")
prop = message.set_property(msg.PropertyId.SUBJECT, "New Subject")
print(f"tag=0x{prop.property_tag:08X}, value={prop.value!r}")

retrieved = message.get_property(msg.PropertyId.SUBJECT)
if retrieved:
    print(retrieved.value)

Properties

NameTypeAccessDescription
property_tagintread-onlyComposite tag computed as (property_id << 16) | property_type.

Key Fields

NameTypeDescription
property_idint16-bit MAPI property identifier.
property_typeint16-bit MAPI property type code (see PropertyTypeCode).
valueAnyDecoded Python value (string, int, datetime, bytes, etc.).
flagsintMAPI property flags bitmask.
namedMapiNamedProperty | NoneNamed property descriptor, if this is a named property.

Methods

SignatureDescription
clone() -> MapiPropertyCreate a deep copy of this property.
clear_raw() -> NoneClear any cached raw byte representation.

See Also