Mailboxes Collection
The Mailboxes collection
contains Mailbox objects used to examine
properties of the IMAP4 mailboxes.
RetrieveMailboxes method
of the IMAP4 object returns Mailboxes
collection of all mailboxes in a user account.
Syntax
Mailboxes.property
Properties | |
Count | Returns the number of mailboxes in the collection. |
Item | Returns a reference to a mailbox in the collection. |
Remarks
Item
is the default property of the collection, so Mailboxes.Item(index)
and Mailboxes(index) are equivalents.
To iterate through the collection, you can use either For .. Each
statement or any common loop statement such as For .. To.
Example
The following examples use different syntax to display names of all mailboxes in a user account. It's assumed the Mailboxes collection has been already retrieved and stored in objMailboxes object.For Each objMailbox In objMailboxes
MsgBox objMailbox.Name
' In ASP, use Response.Write instead of MsgBox
Next
For .. To syntax
For I = 1 To objMailboxes.Count
MsgBox objMailboxes(I).Name
' In ASP, use Response.Write instead of MsgBox
Next
See Also
Mailbox Object, IMAP4.RetrieveMailboxes Method