| Visual Basic (Declaration) | |
|---|---|
Public Function BeginList( _ ByVal reference As String, _ ByVal searchTerm As String, _ ByVal unsubscribed As Boolean, _ ByVal state As Object _ ) As IAsyncResult | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As Imap Dim reference As String Dim searchTerm As String Dim unsubscribed As Boolean Dim state As Object Dim value As IAsyncResult value = instance.BeginList(reference, searchTerm, unsubscribed, state) | |
| C# | |
|---|---|
public IAsyncResult BeginList( string reference, string searchTerm, bool unsubscribed, object state ) | |
| Managed Extensions for C++ | |
|---|---|
public: IAsyncResult* BeginList( string* reference, string* searchTerm, bool unsubscribed, Object* state ) | |
| C++/CLI | |
|---|---|
public: IAsyncResult^ BeginList( String^ reference, String^ searchTerm, bool unsubscribed, Object^ state ) | |
Parameters
- reference
- The directory in which to execute the command.
- searchTerm
- The string to match.
- unsubscribed
- true if unsubscribed and subscribed mailboxes are to be returned by the listing, false if only subscribed are to be returned.
- state
- User state information.
Return Value
An IAsyncResult that represents the asynchronous operation, which could still be pending.| Exception | Description |
|---|---|
| Dart.PowerTCP.Mail.ProtocolException | Bad IMAP protocol response received from server. |
| System.Net.Sockets.SocketException | The requested address is not valid in its context. |
| System.InvalidOperationException | BeginXXX method used without providing an EndXXX event handler. |
The following example demonstrates performing an asynchronous listing.
| Visual Basic | Copy 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); } } | |
The Imap.BeginList method begins to asynchronously list a subset of mailboxes found on the IMAP server by using the IMAP LIST command. Upon completion of this operation, the Imap.EndList event is raised. reference refers to the directory in which to execute the command. searchTerm checks against all mailboxes for matches, and may include wildcards. If unsubscribed is false, the result listing will only contain the Mailboxes the user is subscribed to (using the IMAP LSUB command). If true, the Imap.List command will return all unsubscribed and subscribed mailboxes which meet the criteria. This version of the List method does NOT populate the Imap.Mailboxes collection.
Target Platforms: Microsoft .NET Framework 2.0