IHostedEmailAdaptor.Activate Method (String, String, IDictionary<String, String>)
Initializes the adapter.
Namespace: Microsoft.WindowsServerSolutions.HostedEmail
Assembly: Wssg.HostedEmailBase (in Wssg.HostedEmailBase.dll)
Syntax
void Activate(
string admin,
string password,
IDictionary<string, string> extendedParameters
)
void Activate(
String^ admin,
String^ password,
IDictionary<String^, String^>^ extendedParameters
)
Sub Activate (
admin As String,
password As String,
extendedParameters As IDictionary(Of String, String)
)
Parameters
admin
Type: System.StringName of the administrator.
password
Type: System.StringAdministrator password.
extendedParameters
Type: System.Collections.Generic.IDictionary<String, String>User-defined parameter.
Remarks
The system calls this method when the user requests to initialize the adapter through a call to Enable.
This method is designed to initialize your implementation of IHostedEmailAdaptor. In most implementations, the following should occur:
Verify the subscription information passed in the admin and password parameters, or other format credential information passed in through extendedParameters.
Store the necessary password information for any upcoming call to Connect for this session. The reason is that the call to Connect does not have any parameters: any password information must be passed during the call to Activate.
Examples
The following shows an implementation of the Activate method. For a complete example, see Quickstart: Creating a Hosted Email Adapter.
public void Activate(string admin, string password, IDictionary<string, string> extendedParameters)
{
lock (this)
{
if (IsActivated)
{
logManager.Log("Already activated");
throw new HostedEmailAdaptorException(HostedEmailAdaptorErrorCode.Custom, new AddinErrorRecord()
{
ErrorCode = 0,
Message = Resources.ErrMsg_AlreadyActivated,
Title = Resources.ErrTitle_AlreadyActivated,
});
}
logManager.Log("admin: {0}, password should not be logged", admin);
if (!EmailService.VerifyAdminAccount(admin, password))
{
throw new HostedEmailAdaptorException(HostedEmailAdaptorErrorCode.AuthenticationFailure, null);
}
CredentialManager.ClearAll();
CredentialManager.AdminUserName = admin;
CredentialManager.AdminPassword = password;
}
}
See Also
IHostedEmailAdaptor Interface
Microsoft.WindowsServerSolutions.HostedEmail Namespace
Return to top