Share via


IHostedEmailAdaptor.CreateAccount Method (EmailAccountInfo, String)

 

Creates a new email account.

Namespace:   Microsoft.WindowsServerSolutions.HostedEmail
Assembly:  Wssg.HostedEmailBase (in Wssg.HostedEmailBase.dll)

Syntax

EmailAccountInfo CreateAccount(
    EmailAccountInfo info,
    string password
)
EmailAccountInfo^ CreateAccount(
    EmailAccountInfo^ info,
    String^ password
)
Function CreateAccount (
    info As EmailAccountInfo,
    password As String
) As EmailAccountInfo

Parameters

  • password
    Type: System.String

    The password for the new account. May be null if password sync is enabled. For more information, see the Remarks section.

Return Value

Type: Microsoft.WindowsServerSolutions.HostedEmail.EmailAccountInfo

Returns a EmailAccountInfo containing the information of the new account.

Remarks

This method is called when BeginCreateAccount or CreateAccount is called.

When creating a new account, be sure to specify Info.PrimaryEmailAddress as part of the info parameter.

If password sync is enabled, the system will ask the user to reset their windows logon password. The system will then use the new Windows password as the password for the new email account.

Examples

The following code implements CreateAccount. For the complete code sample, see Quickstart: Creating a Hosted Email Adapter.

public EmailAccountInfo CreateAccount(EmailAccountInfo info, string password)
{
    try
    {
        return EmailService.AddAccount(info);
    }
    catch (AccountExistsException)
    {
        throw new HostedEmailAdaptorException(HostedEmailAdaptorErrorCode.AccountAlreadyExists, new AddinErrorRecord()
        {
            Message = Resources.ErrMsg_OnlineUserAlreadyExist,
            Title = Resources.ErrTitle_OnlineUserAlreadyExist,
        });
    }
}

See Also

IHostedEmailAdaptor Interface
Microsoft.WindowsServerSolutions.HostedEmail Namespace

Return to top