Properties
Provides access to all properties of a top-level object (message, recipient, attachment).
This object is accessed using the .properties
property of a top-level object. The properties for
each top-level object are segregated into its own properties object.
Many property-ids (PIDs) and property-types (PTYPs) are available as constants in
oxml.domain.contants
.
>>> from oxmsg import Message
>>> from oxmsg.domain import constants as c
>>> msg = Message.load("message.msg")
>>> properties = msg.properties
>>> properties.str_prop_value(c.PID_MESSAGE_CLASS).value
'IPM.Note'
Properties
Provides access to properties from an OXMSG storage.
binary_prop_value(pid: int) -> bytes | None
Retrieve bytes of PtypBinary property identified by pid
.
Returns None
if property is not present in this collection.
body_encoding() -> str
The encoding used for a PidTagBody or PidTagHtml property of PtypString8/Binary.
Must be cherry-picked because it is required before constructing the properties collection.
Note when these are PtypString they unconditionally use UTF-16LE.
date_prop_value(pid: int) -> dt.datetime | None
Read datetime property value from the properties stream.
- Microseconds are truncated.
- Returns
None
when nopid
property is present in properties stream.
int_prop_value(pid: int) -> int | None
Retrieve int value of PtypInteger32 property identified by pid
.
Returns None
if no pid
property is present in this collection.
str_prop_value(pid: int) -> str | None
Retrieve str value of PtypString or PtypString8 property identified by pid
.
Returns the empty str if property is not present in this collection.
string_props_are_unicode() -> bool
True indicates PtypString properties in this message are encoded "utf-16-le".
BaseProperty
Base class for properties, providing common behaviors.
factory(segment: bytes, storage: m.PropStorageT, str_prop_encoding: str, body_encoding: str) -> m.PropertyT
classmethod
Construct a property object of the appropriate sub-type for segment
.
name: str
property
The Microsft name for this property, like "PidTagMessageClass".
pid: int
property
The property-id (PID) for this property, like 0x3701 for attachment bytes.
ptyp: int
property
The property-type (PTYP) for this property, like 0x0102 for PtypBinary.
ptyp_name: str
property
The Microsft name for the type of this property, like "PtypString".
BinaryProperty
Bases: BaseProperty
Property for PtypBinary OLE properties.
value() -> bytes
The bytes of this binary property.
BooleanProperty
Bases: BaseProperty
Property for PtypBoolean OLE properties.
value() -> bool
The boolean value of this property.
Float64Property
Bases: BaseProperty
Property for PtypFloating64 OLE properties.
value() -> float
The 64-bit floating-point value of this property.
GuidProperty
Bases: BaseProperty
Property for PtypGuid OLE properties.
__str__() -> str
Hex str representation of this UUID like '9d947746-9662-40a8-a526-abd4faec9737'.
value() -> uuid.UUID
The value of this property as a uuid.UUID object.
The str
value of this object is the standard-form string for the UUID, like:
'9d947746-9662-40a8-a526-abd4faec9737'.
Int16Property
Bases: BaseProperty
Property for PtypInteger16 OLE properties.
value() -> int
The integer value of this property.
Int32Property
Bases: BaseProperty
Property for PtypInteger32 OLE properties.
value() -> int
The integer value of this property.
StringProperty
Bases: BaseProperty
Property for PtypString OLE properties.
value() -> str
The decoded str from this string property.
String8Property
Bases: BaseProperty
Property for PtypString8 (8-bit characters, not Unicode) OLE properties.
value() -> str
The encoded bytes of this string property.
The caller is responsible for determining the encoding and applying it to get a str value.
TimeProperty
Bases: BaseProperty
Property for PtypTime OLE properties.
value() -> dt.datetime
The value of this property as a timezone-aware datetime
.