Dart.Mail Namespace > Imap Class : Select Method |
Public Function Select( _ ByVal mailboxPath As String _ ) As Mailbox
Dim instance As Imap Dim mailboxPath As String Dim value As Mailbox value = instance.Select(mailboxPath)
public Mailbox Select( string mailboxPath )
public: Mailbox* Select( string* mailboxPath )
public: Mailbox^ Select( String^ mailboxPath )
Mailboxes and Mailbox.Mailboxes present a tree of mailboxes that can be selected by assigning one to the SelectedMailbox property. But in many scenarios, the path of the desired mailbox is known and the complete hierarchy is not relevant. In that case this method can be used to directly select a mailbox by specifying its absolute path. Delimiter returns the server's path delimiter if it is not known.
The component will send a SELECT command to initialize Mailbox.FirstUnseen, Mailbox.Marked, Mailbox.Recent, Mailbox.Selectable, and Mailbox.SublevelsAllowed. The server now considers this Mailbox to be in the "Selected" state and messages can be accessed.
The nature of IMAP is that other clients can delete messages on the server at anytime, so using "foreach" to enumerate the messages in a mailbox is not recommended (unsolicited responses may require the removal of the message from the Mailbox before the enumeration completes). Instead, use "foreach" on SelectedMailbox.ToArray(). If, during this enumeration, a message is deleted by another client, MessageBase.Id will be set to 0, so this value can be checked to ensure the existence of the message before acting upon it.
If Imap.Session.AutoUtf8 is set to true, and the server advertises UTF8=ACCEPT, UTF8 will be used for encoding and decoding UNICODE strings.