Overview
MsgReader gives direct access to the raw Compound File Binary (CFB) structure of an Outlook MSG file. It is the underlying engine used by MapiMessage and MsgDocument, and is exposed for advanced scenarios where you need to inspect property streams, directory entries, or storage layout without the overhead of full deserialization. Always use it as a context manager or call close() explicitly to free file handles.
Class Methods
| Signature | Description |
|---|
from_file(path, strict=False) -> MsgReader | Open a .msg file and return a reader. Set strict=True to raise on non-fatal issues. |
parse_top_level_property_stream(data) -> Tuple[PropertyStreamHeaderTopLevel, List[PropertyEntryFixedLength]] | Parse a raw top-level property stream from bytes. |
parse_subobject_property_stream_data(data) -> Tuple[PropertyStreamHeaderSubobject, List[PropertyEntryFixedLength]] | Parse a raw sub-object (recipient/attachment) property stream from bytes. |
Properties
| Name | Type | Access | Description |
|---|
cfb_reader | CFBReader | read-only | The underlying CFB file reader. |
storage_layout | StorageLayout | read-only | Parsed storage directory layout. |
strict | bool | read-only | Whether strict parsing mode is enabled. |
validation_issues | Tuple[str, ...] | read-only | Non-fatal issues found during open. |
Methods
| Signature | Description |
|---|
close() -> None | Close the underlying file handle. |
iter_top_level_fixed_length_properties() -> Iterator[PropertyEntryFixedLength] | Iterate fixed-length property entries from the top-level property stream. |
iter_recipient_storages() -> Iterator[DirectoryEntry] | Iterate CFB directory entries for each recipient storage. |
iter_attachment_storages() -> Iterator[DirectoryEntry] | Iterate CFB directory entries for each attachment storage. |
parse_message_property_stream(storage_stream_id=0) -> Tuple[PropertyStreamHeaderTopLevel, List[PropertyEntryFixedLength]] | Parse the message-level property stream. |
parse_subobject_property_stream(storage_stream_id) -> Tuple[PropertyStreamHeaderSubobject, List[PropertyEntryFixedLength]] | Parse a sub-object property stream by storage stream ID. |
See Also