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
advertisedValuestringThe advertised path, which is used as-is.
hierarchyDelimiterchar?The server's hierarchy delimiter, or null when it reported none.
remoteFolderPathRemoteFolderPathThe validated path, when the advertised one names a folder.
Returns
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.