PowerTCP Mail for .NET
EndList Event
See Also  Example Send comments on this topic.
Dart.PowerTCP.Mail Namespace > Imap Class : EndList Event




Raised when the asynchronous operation started by the Imap.BeginList method completes.

Syntax

Visual Basic (Declaration) 
<CategoryAttribute("Completion")>
Public Event EndList As MailboxEventHandler
Visual Basic (Usage)Copy Code
Dim instance As Imap
Dim handler As MailboxEventHandler
 
AddHandler instance.EndList, handler
C# 
[CategoryAttribute("Completion")]
public event MailboxEventHandler EndList
Managed Extensions for C++ 
[CategoryAttribute("Completion")]
public: __event MailboxEventHandler* EndList
C++/CLI 
[CategoryAttribute("Completion")]
public:
event MailboxEventHandler^ EndList

Event Data

The event handler receives an argument of type MailboxEventArgs containing data related to this event. The following MailboxEventArgs properties provide information specific to this event.

PropertyDescription
Exception (Inherited from Dart.PowerTCP.Mail.EndEventArgs) Gets any exception which occurred during the asynchronous operation.
Mailbox Gets the Mailbox object representing the IMAP mailbox for which the event was raised.
Mailboxes Gets an array of Mailbox objects representing all mailboxes effected by the operation.
State (Inherited from Dart.PowerTCP.Mail.EndEventArgs) Gets the object that was included as part of the associated method call.

Example

The following example demonstrates performing an asynchronous listing.
Visual BasicCopy Code
Private Sub AsynchronousListTest()
   ' Set Autolist to false. We will explicitly call for a listing.
   Imap1.AutoList = False

   ' Login to the server.
   Imap1.Login(Server, User, Pass)

   ' Begin an asynchronous listing.
   Imap1.BeginList(Nothing)
End Sub

Private Sub Imap1_EndList(ByVal sender As Object, ByVal e As Dart.PowerTCP.Mail.MailboxEventArgs) Handles Imap1.EndList
   If e.Exception Is Nothing Then
      Debug.WriteLine("The following mailboxes were reported.")
      Dim Box As Mailbox
      For Each Box In E.Mailboxes
         Debug.WriteLine(Box.Name)
      End If
   End If
End Sub
C#Copy Code
private void AsynchronousListTest()
{
   // Set Autolist to false. We will explicitly call for a listing.
   imap1.AutoList = false;

   // Login to the server.
   imap1.Login(Server, User, Pass);

   // Begin an asynchronous listing.
   imap1.BeginList(null);
}

private void imap1_EndList(object sender, Dart.PowerTCP.Mail.MailboxEventArgs e)
{
   if(e.Exception == null)
   {
      Debug.WriteLine("The following mailboxes were reported.");
      foreach(Mailbox box in e.Mailboxes)
         Debug.WriteLine(box.Name);
   }
}

Remarks

This event is raised when the asynchronous operation started by the Imap.BeginList method completes. A MailboxEventArgs object is passed into the event handler, encapsulating any Mailbox objects affected by the operation. If an exception occurred during the asynchronous operation, it would also be returned in the MailboxEventArgs object in the MailboxEventArgs.Exception property. If an exception is present, it will be thrown if you access any member of the MailboxEventArgs object.

This event MUST be implemented if you are using the Imap.BeginList method. See the topic Using EndXXX Events for more information.

For more information on using PowerTCP events, see the topic Using Events In PowerTCP.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.