Table of Contents

Method TryCreate

Namespace
MailFathom.Domain.Folders
Assembly
MailFathom.Domain.dll

TryCreate(string, char?, out RemoteFolderPath)

Creates a path from what a server advertised, keeping its text exactly and reporting rather than throwing when it names no folder.

public static bool TryCreate(string advertisedValue, char? hierarchyDelimiter, out RemoteFolderPath remoteFolderPath)

Parameters

advertisedValue string

The advertised path, which is used as-is.

hierarchyDelimiter char?

The server's hierarchy delimiter, or null when it reported none.

remoteFolderPath RemoteFolderPath

The validated path, when the advertised one names a folder.

Returns

bool

true when the advertised path names a folder; otherwise, false.

Remarks

The text is not trimmed. IMAP permits a quoted mailbox name that begins or ends with a space, and trimming one would persist a path that selects a different mailbox or none at all — a folder that could then never be synchronized. Normalizing an operator's padding is a configuration concern and stays in Create(string, char?).

Discovery reads whatever a server chooses to list, including entries that name no folder at all, such as a namespace root. One such entry must cost that entry and not the account's whole listing, which is why the rejection is a result here rather than an exception.