Table of Contents

PstNode Class

Definition

Namespace
Bodu.IO.Pst
Assembly
Bodu.IO.Pst.dll
Package
Bodu.IO.Pst 0.7.1
Source
PstNode.cs

Represents one node of the node database: raw access to its data payload and its subnode tree.

public sealed class PstNode
Inheritance
PstNode
Inherited Members
Extension Methods

Remarks

A node's payload is assembled from its data tree on demand and materialized in memory; the multi-block trees the format uses for large payloads are flattened transparently. Subnodes form the node's private namespace - a message node, for example, keeps its recipient and attachment tables there.

Properties

DataLength

Gets the logical length of the node's data payload, in bytes.

public long DataLength { get; }

Property Value

long

The payload length; 0 when the node carries no data.

Remarks

Resolving the length reads only the data tree's internal blocks - never the leaf payloads - so it is cheap even for very large nodes.

Exceptions

ObjectDisposedException

The owning session has been disposed.

PstFileFormatException

The data tree is malformed or fails validation.

HasSubnodes

Gets a value indicating whether the node carries a subnode tree.

public bool HasSubnodes { get; }

Property Value

bool

true when subnodes are present.

Id

Gets the node identifier.

public PstNodeId Id { get; }

Property Value

PstNodeId

The identifier.

ParentId

Gets the parent node identifier the directory records.

public PstNodeId ParentId { get; }

Property Value

PstNodeId

The parent identifier, or the zero identifier when none is recorded.

Methods

EnumerateSubnodes()

Enumerates the node's subnodes, in stored order.

public IEnumerable<PstNodeInfo> EnumerateSubnodes()

Returns

IEnumerable<PstNodeInfo>

The subnode directory facts; empty when the node carries no subnode tree.

Exceptions

ObjectDisposedException

The owning session has been disposed.

PstFileFormatException

The subnode tree is malformed or fails validation.

OpenDataStream()

Opens the node's data payload as a read-only stream.

public Stream OpenDataStream()

Returns

Stream

A seekable stream over the payload.

Remarks

The stream reads one leaf block at a time through the session's decoded-block cache, so an arbitrarily large payload is never materialized; use ReadAllBytes() for the buffered convenience.

The stream is bound to this session: after the session is disposed every read throws ObjectDisposedException, even for data already cached. Dispose the stream before the session.

Exceptions

ObjectDisposedException

The owning session has been disposed.

PstFileFormatException

The data tree is malformed or fails validation.

ReadAllBytes()

Reads the node's complete data payload.

public byte[] ReadAllBytes()

Returns

byte[]

The payload bytes; empty when the node carries no data.

Exceptions

ObjectDisposedException

The owning session has been disposed.

PstFileFormatException

The data tree is malformed or fails validation.

ReadPropertyContext()

Reads the node's LTP property context: the property bag of 16-bit property identifiers with wire-typed values.

public PstPropertyContext ReadPropertyContext()

Returns

PstPropertyContext

The property context.

Remarks

Each call re-reads the context from the source; retain the returned instance to read many properties. Value payloads resolve on access, so large subnode-resident values cost their read only when retrieved.

Exceptions

ObjectDisposedException

The owning session has been disposed.

PstFileFormatException

The node's heap does not carry a property context, or the context is malformed.

ReadTableContext()

Reads the node's LTP table context: the table of typed columns over identifier-keyed rows.

public PstTableContext ReadTableContext()

Returns

PstTableContext

The table context.

Remarks

Each call re-reads the context from the source; retain the returned instance to read many rows. Row enumeration streams the row matrix one block at a time.

Exceptions

ObjectDisposedException

The owning session has been disposed.

PstFileFormatException

The node's heap does not carry a table context, or the context is malformed.

ToString()

Returns a textual form of the node for diagnostics.

public override string ToString()

Returns

string

The identifier and its type.

TryGetSubnode(PstNodeId, out PstNode)

Attempts to retrieve a subnode by identifier.

public bool TryGetSubnode(PstNodeId id, out PstNode subnode)

Parameters

id PstNodeId

The subnode identifier.

subnode PstNode

When this method returns true, the subnode.

Returns

bool

true when the subnode exists.

Exceptions

ObjectDisposedException

The owning session has been disposed.

PstFileFormatException

The subnode tree is malformed or fails validation.

TryGetSubnodeOfType(PstNodeType, out PstNode)

Attempts to retrieve the first subnode of a given type, in stored order, in a single pass over the subnode directory.

public bool TryGetSubnodeOfType(PstNodeType type, out PstNode subnode)

Parameters

type PstNodeType

The node type sought.

subnode PstNode

When this method returns true, the subnode.

Returns

bool

true when the node carries a subnode of the type.

Exceptions

ObjectDisposedException

The owning session has been disposed.

PstFileFormatException

The subnode tree is malformed or fails validation.

Applies to

ProductVersions
.NET8, 10