
| Visual Basic (Declaration) | |
|---|---|
<DefaultMemberAttribute("Item")> Public Class MailboxCollection Inherits System.Collections.ArrayList | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As MailboxCollection | |
| C# | |
|---|---|
[DefaultMemberAttribute("Item")] public class MailboxCollection : System.Collections.ArrayList | |
| Managed Extensions for C++ | |
|---|---|
[DefaultMemberAttribute("Item")] public __gc class MailboxCollection : public System.Collections.ArrayList | |
| C++/CLI | |
|---|---|
[DefaultMemberAttribute("Item")] public ref class MailboxCollection : public System.Collections.ArrayList | |
| Visual Basic | Copy Code |
|---|---|
Private Sub MailboxCollectionTest() ' Login Imap1.Login(Server, User, Pass) ' Create a new mailbox. Imap1.Mailboxes.Add("MyNewBox") ' Get the Mailbox in a short variable name to reduce typing. Dim Box As New Mailbox = Imap1.Mailboxes("MyNewBox") ' APPEND some test messages Dim i As Integer For i = 0 To 5 ' Dynamically create a new message Dim Msg As New MessageStream() Msg.To.Add(New MailAddress("me@test.com")) Msg.From = New MailAddress("you@test.com") Msg.Subject = "test # " + i Msg.Text = "Hello, how are you?" ' Append the message Box.Messages.Add(msg) Next ' Refresh the mail box so new messages will be included Box.Refresh() ' Display a list of the message identifiers. Debug.WriteLine(Box.Messages.ToString()) ' Clear all messages Box.Messages.Clear() ' Logout Imap1.Logout() End Sub | |
| C# | Copy Code |
|---|---|
private void MailboxCollectionTest() { // Login imap1.Login(Server, User, Pass); // Create a new mailbox. imap1.Mailboxes.Add("MyNewBox"); // Get the Mailbox in a short variable name to reduce typing. Mailbox box = imap1.Mailboxes["MyNewBox"]; // APPEND some test messages for(int i=0; i < 5; i++) { // Dynamically create a new message MessageStream msg = new MessageStream(); msg.To.Add(new MailAddress("me@test.com")); msg.From = new MailAddress("you@test.com"); msg.Subject = "test # " + i; msg.Text = "Hello, how are you?"; // Append the message box.Messages.Add(msg); } // Refresh the mail box so new messages will be included box.Refresh(); // Display a list of the message identifiers. Debug.WriteLine(box.Messages.ToString()); // Clear all messages box.Messages.Clear(); // Logout imap1.Logout(); } | |
The MailboxCollection class contains only Mailbox objects that exist on an IMAP server. It is used to represent either the results of an Imap.List method call (as the Imap.Mailboxes property), or as the collection of child mailboxes to a given mailbox (Mailbox.Mailboxes).
The MailboxCollection class can be manipulated by using the Mailbox.Add, Mailbox.Remove, and Mailbox.Refresh methods. Since this is a server-side collection, calling these methods sends the associated IMAP command to the server. For example, calling MailboxCollection.Remove results in a DELETE command being sent to the server to actually delete the mailbox. If any method called results in the addition, deletion, or modification of a mailbox, the MailboxCollection will be automatically updated to reflect this.
Typically, the Mailbox objects representing mailboxes contained within this collection are dynamically generated the first time the collection is accessed.
System.Object
System.Collections.ArrayList
Dart.PowerTCP.Mail.MailboxCollection
Target Platforms: Microsoft .NET Framework 2.0