Dart.Mail Namespace > Imap Class : Mailboxes Property |
Public ReadOnly Property Mailboxes As MailboxCollection
Dim instance As Imap Dim value As MailboxCollection value = instance.Mailboxes
public MailboxCollection Mailboxes {get;}
public: __property MailboxCollection* get_Mailboxes();
public: property MailboxCollection^ Mailboxes { MailboxCollection^ get(); }
/// <summary> /// Navigates into the subfolder/sub-mailbox specified by 'subfolderPath'. /// </summary> /// <param name="myImap">A connected and authenticated Imap instance</param> /// <param name="subfolderPath">Path to the subfolder from root, delimited by '/' in this snippet.</param> /// <remarks> /// Imap.Select() may be used to access the path directly, but it will not populate the surrounding mailbox tree. /// </remarks> public void NavigateToSubfolder(Imap myImap, string subfolderPath) { //Separate provided path into each subfolder name string[] subfolderNameArray = subfolderPath.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries); //myImap.Mailboxes will already be populated by myImap.Authenticate(), so set to the first subfolder Mailbox currentMailbox = myImap.Mailboxes[subfolderNameArray[0]]; //Subfolders (currentMailbox.Mailboxes) will not be populated, so start drilling down for (int i = 1; i <= subfolderNameArray.Length - 1; i++) { //If the entire mailbox structure was not populated upon login, refresh it now if(!myImap.Session.PopulateMailboxTree) currentMailbox.Mailboxes.Refresh(); currentMailbox = currentMailbox.Mailboxes[subfolderNameArray[i]]; } //Now that the end of the specified path has been reached, select that mailbox myImap.SelectedMailbox = currentMailbox; }
''' <summary> ''' Navigates into the subfolder/sub-mailbox specified by 'subfolderPath'. ''' </summary> ''' <param name="myImap">A connected and authenticated Imap instance</param> ''' <param name="subfolderPath">Path to the subfolder from root, delimited by '/' in this snippet.</param> ''' <remarks> ''' Imap.Select() may be used to access the path directly, but it will not populate the surrounding mailbox tree. ''' </remarks> Public Sub NavigateToSubfolder(ByVal myImap As Imap, ByVal subfolderPath As String) 'Separate provided path into each subfolder name Dim subfolderNameArray() As String = subfolderPath.Split(New String() { "/" }, StringSplitOptions.RemoveEmptyEntries) 'myImap.Mailboxes will already be populated by myImap.Authenticate(), so set to the first subfolder Dim currentMailbox As Mailbox = myImap.Mailboxes(subfolderNameArray(0)) 'Subfolders (currentMailbox.Mailboxes) will not be populated, so start drilling down For i As Integer = 1 To subfolderNameArray.Length - 1 'If the entire mailbox structure was not populated upon login, refresh it now If Not myImap.Session.PopulateMailboxTree Then currentMailbox.Mailboxes.Refresh() End If currentMailbox = currentMailbox.Mailboxes(subfolderNameArray(i)) Next i 'Now that the end of the specified path has been reached, select that mailbox myImap.SelectedMailbox = currentMailbox End Sub