RetrieveMailboxesEx Method
This method retrieves Mailboxes collection which contains mailboxes of the IMAP4 account. This collection includes only mailboxes which are passed user defined criteria. For getting all mailboxes of the account it's better to use RetrieveMailboxes method of the IMAP4 object.
| objMailboxes = ObjectName.RetrieveMailboxes(RootMailBoxName, [SubscribedOnly], OneLevelOnly) | ||
| Parameters: | ||
| RootMailboxName As String | If not empty only sub-folders of the specified mailbox will be retrieved, otherwise all folders of the account will be retrieved | |
| SubscribedOnly As Boolean | (optional) If True the only subscribed mailboxes will be retrieved. Default is False | |
| OneLevelOnly | If True only first level sub-folders of the mailbox will be retrieved | |
| Return value As MailBee.Mailboxes | On success, Mailboxes collection is returned. On failure, return value is Nothing | |
Usage example:
' This sample gets first-level mailboxes list and selects last mailbox in the collection. ' Then, number of messages is displayed for this mailbox. Dim Mailer, Mailboxes ' Using visual basic to create object Set Mailer = CreateObject("MailBee.IMAP4") ' Using ASP to create object ' Set Mailer = Server.CreateObject("MailBee.IMAP4") ' In ASP use Response.Write instead of MsgBox Mailer.EnableLogging = True Mailer.LogFilePath = "C:\imap4_log.txt" Mailer.ClearLog Mailer.LicenseKey = "put your license key" If Mailer.Connect("mailserver.com", 143, "MyName", "MyPassword") Then Set Mailboxes = Mailer.RetrieveMailboxesEx("", False, True) If Not Mailboxes Is Nothing Then If (Mailboxes.Count > 0) Then If Mailer.SelectMailbox(Mailboxes(Mailboxes.Count).Name) Then MsgBox Mailer.MessageCount & " messages in " & Mailboxes(Mailboxes.Count).Name End If End If End If Mailer.Disconnect End If
See Also:
RetrieveMailboxes Method | ExamineMailbox Method | SelectMailbox Method | Mailbox Object | Mailboxes Collection
Copyright 2002-2008, AfterLogic Corporation. All rights reserved.