Note: This API is now obsolete.
Begins an asynchronous request for a logging in an account on an IMAP4 server.
Namespace: MailBee.ImapMailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax [ObsoleteAttribute("This method is obsolete in .NET 4.5+. Use LoginAsync instead.")]
public IAsyncResult BeginLogin(
string targetName,
string domain,
string accountName,
string password,
AuthenticationMethods authMethods,
AuthenticationOptions authOptions,
SaslMethod authUserDefined,
AsyncCallback callback,
Object state
)
<ObsoleteAttribute("This method is obsolete in .NET 4.5+. Use LoginAsync instead.")>
Public Function BeginLogin (
targetName As String,
domain As String,
accountName As String,
password As String,
authMethods As AuthenticationMethods,
authOptions As AuthenticationOptions,
authUserDefined As SaslMethod,
callback As AsyncCallback,
state As Object
) As IAsyncResult
Parameters
- targetName
- Type: SystemString
The Service Principal Name of the server. Used only with GSSAPI/Kerberos authentication. You can leave it a null reference (Nothing in Visual Basic) or an empty string. - domain
- Type: SystemString
The user account domain on the server. Used only with NTLM and GSSAPI authentication. You can leave it a null reference to use the current domain. - accountName
- Type: SystemString
The user account name on the server. You can leave it a null reference when using NTLM or GSSAPI and wish to authenticate as the current Windows user. - password
- Type: SystemString
The password of the user account on the server. - authMethods
- Type: MailBeeAuthenticationMethods
A set of authentication methods which can be used when logging in a mailbox. - authOptions
- Type: MailBeeAuthenticationOptions
Specifies the options which affect login process. - authUserDefined
- Type: MailBeeSaslMethod
A reference to the instance of user defined authentication method,
or a null reference (Nothing in Visual Basic) if user defined authentication is not used. - 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 login process.
Exceptions Remarks Examples This sample demonstrates asynchronous logging in an account and use of a callback function
in a console application.
using System;
using MailBee;
using MailBee.ImapMail;
class Sample
{
private static void LoginCallback(IAsyncResult result)
{
Imap imp = (Imap)result.AsyncState;
imp.EndLogin();
imp.SelectFolder("INBOX");
Console.WriteLine("Message #" + imp.Unseen + " is first unseen");
}
static void Main(string[] args)
{
Imap imp = new Imap();
imp.Connect("imap.somehost.com");
IAsyncResult ar = imp.BeginLogin(null, null, "jdoe", "secret",
AuthenticationMethods.Auto, AuthenticationOptions.None,
null, new AsyncCallback(LoginCallback), imp);
System.Threading.Thread.Sleep(3000);
while (imp.IsBusy) ar.AsyncWaitHandle.WaitOne();
imp.Disconnect();
}
}
Imports System
Imports MailBee
Imports MailBee.ImapMail
Class Sample
Private Shared Sub LoginCallback(ByVal result As IAsyncResult)
Dim imp As New Imap
imp = result.AsyncState
imp.EndLogin()
imp.SelectFolder("INBOX")
Console.WriteLine("Message #" & imp.Unseen & " is first unseen")
End Sub
Shared Sub Main(ByVal args As String())
Dim imp As New Imap
imp.Connect("imap.somehost.com")
Dim ar = imp.BeginLogin(Nothing, Nothing, "jdoe", "secret", _
AuthenticationMethods.Auto, AuthenticationOptions.None, _
Nothing, New AsyncCallback(AddressOf LoginCallback), imp)
System.Threading.Thread.Sleep(3000)
While imp.IsBusy
ar.AsyncWaitHandle.WaitOne()
End While
imp.Disconnect()
End Sub
End Class
See Also