| Visual Basic (Declaration) | |
|---|---|
Public ReadOnly Property Messages As ImapMessageCollection | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As Mailbox Dim value As ImapMessageCollection value = instance.Messages | |
| C# | |
|---|---|
public ImapMessageCollection Messages {get;} | |
| Managed Extensions for C++ | |
|---|---|
public: __property ImapMessageCollection* get_Messages(); | |
| C++/CLI | |
|---|---|
public: property ImapMessageCollection^ Messages { ImapMessageCollection^ get(); } | |
Property Value
An ImapMessageCollection which contains all messages in the mailbox.The following example demonstrates retrieving partial messages.
| Visual Basic | Copy Code |
|---|---|
' Login to the server Imap1.Login(Server, User, Pass) ' Get the current mailbox in a short variable name so we don't have to type as much Dim Box As Mailbox = Imap1.CurrentMailbox Dim First As ImapMessage = Box.Messages(0) Dim Last As ImapMessage = Box.Messages(box.Messages.Count - 1) ' Get all message headers and messages sizes Box.Get(First, Last, ImapMessageSections.Header | ImapMessageSections.Size) ' Display Results. Dim Msg as ImapMessage For Each Msg in Box.Messages Debug.WriteLine("Size: " + Msg.Size) Debug.WriteLine("Subject: " + Msg.Message.Subject) Next ' Logout Imap1.Logout() | |
| C# | Copy Code |
|---|---|
// Login to the server imap1.Login(Server, User, Pass); // Get the current mailbox in a short variable name so we don't have to type as much Mailbox box = imap1.CurrentMailbox; ImapMessage first = box.Messages[0]; ImapMessage last = box.Messages[box.Messages.Count - 1]; // Get all message headers and messages sizes box.Get(first, last, ImapMessageSections.Header | ImapMessageSections.Size); // Display Results. foreach(ImapMessage msg in box.Messages) { Debug.WriteLine("Size: " + msg.Size); Debug.WriteLine("Subject: " + msg.Message.Subject); } // Logout imap1.Logout(); | |
The Mailbox.Messages property returns the ImapMessageCollection object containing ImapMessage objects representing each message in this mailbox. This collection will not be populated with messages upon first access. You must first call Mailbox.Refresh for this collection to have any items.
Target Platforms: Microsoft .NET Framework 2.0
Copy Code