MapiPropertyCollection

MapiPropertyCollection

Overview

MapiPropertyCollection is a keyed container of MapiProperty objects attached to a MapiMessage, MapiRecipient, or MapiAttachment. It provides dictionary-like semantics for setting, retrieving, and removing properties by property ID, and supports full iteration over all entries. Modifying the collection directly is an alternative to calling set_property() / get_property() on the parent object.

from aspose.email_foss import msg

message = msg.MapiMessage.create("Test", "Body")
props = message.properties
for p in props.iter_properties():
    print(f"0x{p.property_tag:08X} = {p.value!r}")

Methods

SignatureDescription
set(property) -> MapiPropertyInsert or replace a MapiProperty in the collection.
add(property_id, property_type, value, flags=..., named=None) -> MapiPropertyBuild a new MapiProperty from components and add it.
get(property_id, property_type=None) -> MapiProperty | NoneLook up a property by ID, optionally filtered by type.
remove(property_id, property_type=None) -> NoneRemove a property from the collection.
iter_properties() -> Iterator[MapiProperty]Iterate over all MapiProperty entries.

See Also