Share via


HostedEmailManager Constructor (Guid)

 

Creates a new instance of a HostedEmailManager using the specified add-in ID.

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

Syntax

public HostedEmailManager(
    Guid addinId
)
public:
HostedEmailManager(
    Guid addinId
)
Public Sub New (
    addinId As Guid
)

Parameters

  • addinId
    Type: System.Guid

    ID of the specific hosted email add-in to manage.

Remarks

The add-in ID should match the add-in ID implementation of the targeted implementation of IHostedEmailAdaptor.

Examples

The following code uses the constructor to create a new HostedEmailManager instance in order to retrieve email account information. For the complete code sample, see Quickstart: Creating a Hosted Email Adapter.

private void LoadEmailAccountInfo(string wssUserName)
{
    HostedEmailManager manager = new HostedEmailManager(Constants.AdaptorId);
    if (!manager.Connect())
    {
        throw new InvalidOperationException("HostedEmailManager connection failed");
    }
    var info = manager.GetAccount(wssUserName);

    if (info == null || info.ExtendedProperties == null || !info.ExtendedProperties.ContainsKey(Constants.ExtendedParam_DGs))
    {
        throw new InvalidOperationException("Cannot load distribution groups that the user belongs to");
    }
    accountId = info.AccountId;
    userDGs = info.ExtendedProperties[Constants.ExtendedParam_DGs].Split(Constants.ExtendedParam_DGs_Delimiter);
}

See Also

HostedEmailManager Class
Microsoft.WindowsServerSolutions.HostedEmail Namespace

Return to top