Table of Contents

OutlookMessageReaderOptions Class

Definition

Namespace
Bodu.Formats.Outlook
Assembly
Bodu.Formats.Outlook.Msg.dll
Package
Bodu.Formats.Outlook.Msg 0.7.1
Source
OutlookMessageReaderOptions.cs

Controls how an OutlookMessage opens its container and handles malformed content.

public sealed class OutlookMessageReaderOptions
Inheritance
OutlookMessageReaderOptions
Inherited Members
Extension Methods

Remarks

The defaults mirror the underlying CompoundFileOptions: the container is buffered whole and validated at Compatible, under which a malformed property is omitted rather than failing the open. Strict makes structural problems throw OutlookMsgFormatException instead.

Constructors

OutlookMessageReaderOptions()

public OutlookMessageReaderOptions()

Properties

DecompressRtf

Gets a value indicating whether the compressed RTF body is decompressed when read through the body conveniences.

public bool DecompressRtf { get; init; }

Property Value

bool

true to decompress PidTagRtfCompressed on access; the default. When false the RTF body convenience returns null and the raw payload remains available through the property collection.

MaxDecompressedRtfBytes

Gets the largest decompressed RTF body, in bytes, the reader produces.

public int MaxDecompressedRtfBytes { get; init; }

Property Value

int

The ceiling; 64 MiB by default.

Remarks

A compressed payload whose declared or produced size exceeds the ceiling is rejected with OutlookMsgFormatException at every validation level: the declared size sits outside the payload's checksum, so it must be bounded rather than trusted.

Exceptions

ArgumentOutOfRangeException

The value is zero or negative.

MaxEmbeddedMessageDepth

Gets the deepest embedded-message nesting the reader opens: the root message is depth zero, a message opened from one of its attachments is depth one, and so on.

public int MaxEmbeddedMessageDepth { get; init; }

Property Value

int

The nesting limit; 16 by default.

Remarks

Opening an embedded message past the limit throws OutlookMsgFormatException at every validation level. The limit exists because a crafted container can nest attachments thousands of levels deep in a few kilobytes, and a consumer walking the tree recursively would otherwise exhaust its stack.

Exceptions

ArgumentOutOfRangeException

The value is zero or negative.

MaxInlineAttachmentBytes

Gets the largest by-value attachment payload, in bytes, that is decoded into the attachment's Properties; a larger PidTagAttachDataBinary stream is left in the container and served only through OpenContentStream().

public int MaxInlineAttachmentBytes { get; init; }

Property Value

int

The inline payload limit; 1 MiB by default.

Remarks

Above the limit the property is still present in the collection, with a null value, so Contains(MapiPropertyTag) and Method are unaffected; GetBinary(ushort) returns null and the content is read from the container when the stream is opened. Combined with Streaming the payload is never held in memory in full. This is an inline-decoding threshold, not a validation rule: it does not vary with ValidationLevel.

Exceptions

ArgumentOutOfRangeException

The value is zero or negative.

ReadStrategy

Gets the strategy used to source the container's bytes.

public CompoundReadStrategy ReadStrategy { get; init; }

Property Value

CompoundReadStrategy

The read strategy; Buffered by default.

ValidationLevel

Gets how strictly the container and the message structures are validated.

public CompoundValidationLevel ValidationLevel { get; init; }

Property Value

CompoundValidationLevel

The validation level; Compatible by default.

Applies to

ProductVersions
.NET8, 10