OutlookMailFolder Class
Definition
- Assembly
- Bodu.Formats.Outlook.Pst.dll
- Package
- Bodu.Formats.Outlook.Pst 1.3.0
- Source
- OutlookMailFolder.cs
Represents one folder of a mail store: its decoded properties and streaming access to its subfolders and messages.
public sealed class OutlookMailFolder
- Inheritance
-
OutlookMailFolder
- Inherited Members
- Extension Methods
Remarks
Folder views are bound to their owning OutlookMailStore session. Enumerations stream the folder's hierarchy and contents tables one row block at a time - nothing is materialized ahead of iteration - and a folder whose table node is absent enumerates empty, matching real-world stores that omit empty tables.
Under strict validation a table row that does not reference a valid node of the expected kind throws OutlookPstFormatException; under the tolerant levels the row is skipped. Container corruption met while the folder decodes or enumerates throws OutlookPstFormatException at every level, with the container's PstFileException as the inner exception.
Properties
ContainerClass
Gets the folder container class (for example, IPF.Note).
public string? ContainerClass { get; }
Property Value
DisplayName
Gets the folder display name.
public string? DisplayName { get; }
Property Value
HasSubfolders
Gets a value indicating whether the folder declares subfolders.
public bool HasSubfolders { get; }
Property Value
MessageCount
Gets the number of messages the folder declares.
public int? MessageCount { get; }
Property Value
Properties
Gets every decoded property of the folder.
public MapiPropertyCollection Properties { get; }
Property Value
- MapiPropertyCollection
The tag-addressed property collection, decoded once on first access.
Remarks
An exception thrown by ValueOmittedCallback while the properties are decoded propagates from this access unchanged.
Exceptions
- ObjectDisposedException
The owning session has been disposed.
- OutlookPstFormatException
The container is malformed, or, under strict validation, a property value cannot be decoded.
UnreadCount
Gets the number of unread messages the folder declares.
public int? UnreadCount { get; }
Property Value
Methods
EnumerateAssociatedMessages()
Enumerates the folder's associated (folder-associated-information) messages, in table order.
public IEnumerable<OutlookMailMessage> EnumerateAssociatedMessages()
Returns
- IEnumerable<OutlookMailMessage>
The associated-message views; empty when the folder has no associated-contents table.
Exceptions
- ObjectDisposedException
The owning session has been disposed.
- OutlookPstFormatException
The container is malformed, or, under strict validation, an associated-contents row does not reference a valid message node.
EnumerateMessages()
Enumerates the folder's messages, in contents-table order.
public IEnumerable<OutlookMailMessage> EnumerateMessages()
Returns
- IEnumerable<OutlookMailMessage>
The message views; empty when the folder has no contents table.
Exceptions
- ObjectDisposedException
The owning session has been disposed.
- OutlookPstFormatException
The container is malformed, or, under strict validation, a contents row does not reference a valid message node.
EnumerateSubfolders()
Enumerates the folder's immediate subfolders, in hierarchy-table order.
public IEnumerable<OutlookMailFolder> EnumerateSubfolders()
Returns
- IEnumerable<OutlookMailFolder>
The subfolder views; empty when the folder has no hierarchy table.
Remarks
Search folders are Outlook runtime state, not archive content, and are excluded from the enumeration at every validation level - the standard search root hangs off the hierarchy of real stores.
Exceptions
- ObjectDisposedException
The owning session has been disposed.
- OutlookPstFormatException
The container is malformed, or, under strict validation, a hierarchy row does not reference a valid folder node.
ToString()
Returns a textual form of the folder for diagnostics.
public override string ToString()
Returns
- string
The display name, or the node identifier when unnamed.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |