PstWriterFolder Class

A folder of a file a PstWriter writes. The items added to it are written immediately; the folder itself is written by PstWriter.Complete.

public sealed class PstWriterFolder

Properties

NameDescription
ContainerClassGets or sets the class of the items of the folder, such as IPF.Note, IPF.Contact, IPF.Appointment or IPF.Task.
DisplayNameGets or sets the display name of the folder.
FoldersGets the subfolders.
ItemCountGets the number of items added to the folder.
ParentGets the parent folder, or null for the root folder of the file.
PropertiesGets the properties of the folder. The display name, the container class and the counts are set by the writer.

ContainerClass

PstWriterFolder.cs

Gets or sets the class of the items of the folder, such as IPF.Note, IPF.Contact, IPF.Appointment or IPF.Task.

public string? ContainerClass { get; set; }

Property value

string?

Gets or sets the display name of the folder.

public string DisplayName { get; set; }

Property value

string

Gets the subfolders.

public IReadOnlyList<PstWriterFolder> Folders { get; }

Gets the number of items added to the folder.

public int ItemCount { get; }

Property value

int

Gets the parent folder, or null for the root folder of the file.

public PstWriterFolder? Parent { get; }

Property value

PstWriterFolder?

Gets the properties of the folder. The display name, the container class and the counts are set by the writer.

public MapiPropertyBag Properties { get; }

Property value

MapiPropertyBag

Methods

NameDescription
AddItem(MapiMessageBuilder)Writes an item to the folder. The builder can be reused or modified after the call: the item is already written. A content set from a stream that cannot seek is read once: set it again before writing the builder again.
CreateFolder(string, string?)Creates a subfolder.
ToString()Returns the display name of the folder.

AddItem(MapiMessageBuilder)

PstWriterFolder.cs

Writes an item to the folder. The builder can be reused or modified after the call: the item is already written. A content set from a stream that cannot seek is read once: set it again before writing the builder again.

public void AddItem(MapiMessageBuilder item)

Parameters

item MapiMessageBuilder
The item.

Exceptions

InvalidOperationException
The writer is completed, or the folder is a search folder.
ArgumentException
A property has a value that its type cannot store.

CreateFolder(string, string?)

PstWriterFolder.cs

Creates a subfolder.

public PstWriterFolder CreateFolder(string displayName, string? containerClass = null)

Parameters

displayName string
The display name of the folder.
containerClass string?
The class of the items of the folder, such as IPF.Note, or null.

Returns

PstWriterFolder The new folder.

Exceptions

InvalidOperationException
The writer is completed, or the folder is a search folder.

Returns the display name of the folder.

public override string ToString()

Returns

string The display name of the folder.