Convert VBS code to C #

I have the code below that was provided as the hMailServer DCOM API at http://www.hmailserver.com/documentation/latest/?page=com_example_account_create The below script works fine. He doesn't say anything. Immediately after installing hMailServer, running the code below can create an account. Now I need the same in C #. They did not provide me with any library for C # that I was looking for for it, but I have no relevant results, but below, according to the hMailServer API, they can convert the below script to any language you want. But how? I don’t even understand how to start writing even the first line. Someone please help me.

Dim obApp
   Set obApp = CreateObject("hMailServer.Application")

   ' Authenticate. Without doing this, we won't have permission
   ' to change any server settings or add any objects to the
   ' installation.   
   Call obApp.Authenticate("Administrator", "your-main-hmailserver-password")

   ' Locate the domain we want to add the account to
   Dim obDomain
   Set obDomain = obApp.Domains.ItemByName("example.com")

   Dim obAccount
   Set obAccount = obDomain.Accounts.Add

   ' Set the account properties
   obAccount.Address = "account@example.com"
   obAccount.Password = "secret"
   obAccount.Active = True
   obAccount.MaxSize = 100 ' Allow max 100 megabytes

   obAccount.Save
+5
2

COM- (hMailServer) # #.

:

var app = new hMailServer.Application();

// Authenticate. Without doing this, we won't have permission
// to change any server settings or add any objects to the
// installation.   
app.Authenticate("Administrator", "your-main-hmailserver-password");

// Locate the domain we want to add the account to
var domain = app.Domains["example.com"];

var account = domain.Accounts.Add();

// Set the account properties
account.Address = "account@example.com";
account.Password = "secret";
account.Active = true;
account.MaxSize = 100; // Allow max 100 megabytes

account.Save();
+8

, -. get item , , hMailServer.

protected void Page_Load(object sender, EventArgs e)
{
    var app = new hMailServer.Application();

    // Authenticate. Without doing this, we won't have permission
    // to change any server settings or add any objects to the
    // installation.   
    app.Authenticate("Administrator", "your.admin.password.here");

    // Locate the domain we want to add the account to
    var domain = app.Domains.get_ItemByName("your.configured.domain.name.here");

    var account = domain.Accounts.Add();

    // Set the account properties
    account.Address = "account.name.here";
    account.Password = "pass.word.here";
    account.Active = true;
    account.MaxSize = 100; // Allow max 100 megabytes

    account.Save();
}
+2

All Articles