ImapBeginSelectFolder Method |
Note: This API is now obsolete.
Begins an asynchronous request for selecting a folder in an account on an IMAP4 server.
Namespace: MailBee.ImapMailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax [ObsoleteAttribute("This method is obsolete in .NET 4.5+. Use SelectFolderAsync instead.")]
public IAsyncResult BeginSelectFolder(
string folderName,
bool readOnly,
AsyncCallback callback,
Object state
)
<ObsoleteAttribute("This method is obsolete in .NET 4.5+. Use SelectFolderAsync instead.")>
Public Function BeginSelectFolder (
folderName As String,
readOnly As Boolean,
callback As AsyncCallback,
state As Object
) As IAsyncResult
Parameters
- folderName
- Type: SystemString
The full name of the folder to be selected. - readOnly
- Type: SystemBoolean
Indicates if the folder should be selected in read-only mode. - callback
- Type: SystemAsyncCallback
The AsyncCallback delegate. You can leave it a null reference
(Nothing in Visual Basic) if you do not use callbacks. - state
- Type: SystemObject
An object that contains state information for this request.
You can leave it a null reference (Nothing in Visual Basic).
Return Value
Type:
IAsyncResultAn
IAsyncResult that references the asynchronous select folder process.
Exceptions Remarks Examples This sample demonstrates asynchronous selecting a folder and use of a callback function
in a console application.
using System;
using MailBee;
using MailBee.ImapMail;
class Sample
{
private static void SelectFolderCallback(IAsyncResult result)
{
Imap imp = (Imap)result.AsyncState;
imp.EndSelectFolder();
Console.WriteLine("Overall size of all messages in the inbox is " +
imp.GetFolderSize() + " bytes");
}
static void Main(string[] args)
{
Imap imp = new Imap();
imp.Connect("imap4.somehost.com");
imp.Login("jdoe@somehost.com", "secret");
IAsyncResult ar = imp.BeginSelectFolder("Inbox", false,
new AsyncCallback(SelectFolderCallback), imp);
System.Threading.Thread.Sleep(3000);
while (imp.IsBusy) ar.AsyncWaitHandle.WaitOne();
imp.Disconnect();
}
}
Imports System
Imports MailBee
Imports MailBee.ImapMail
Module Sample
Private Sub SelectFolderCallback(ByVal result As IAsyncResult)
Dim imp As Imap = CType(result.AsyncState, Imap)
imp.EndSelectFolder()
Console.WriteLine("Overall size of all messages in the inbox is " & _
imp.GetFolderSize() & " bytes")
End Sub
Sub Main()
Dim imp As New Imap
imp.Connect("imap4.company.com")
imp.Login("jdoe@company.com", "secret")
Dim ar As IAsyncResult = imp.BeginSelectFolder("Inbox", False, _
New AsyncCallback(AddressOf SelectFolderCallback), imp)
System.Threading.Thread.Sleep(3000)
While imp.IsBusy
ar.AsyncWaitHandle.WaitOne()
End While
imp.Disconnect()
End Sub
End Module
See Also