PowerTCP Mail for .NET
Select Method




An absolute path to the desired mailbox, with mailbox names delimited by Delimiter.
Creates a new Mailbox and sets SelectedMailbox to this value.
Syntax
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
) 

Parameters

mailboxPath
An absolute path to the desired mailbox, with mailbox names delimited by Delimiter.

Return Value

Returns a Mailbox that is in the selected state (it is assigned to SelectedMailbox).
Remarks

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.

See Also

Reference

Imap Class
Imap Members


PowerTCP Mail for .NET Documentation Version 4.3
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic