Creating an exchange account. How to create mailbox?

J

Jeremy Chapman

I'm trying to create an exchange account and mailbox using LDAP. So far I've
created the exchange account, and it looks good when viewing it in Exchange
administrator (Exchange 5.5).

How do I associate it to an active directory?
How do I create the mailbox for the account? (I tried to add the new account
as an additional mailbox in outlook, but I get an error that the set of
folders could not be opened)

Here is the code I used to create the exchange account:


DirectoryEntry pDE = new DirectoryEntry();
pDE.AuthenticationType = AuthenticationType;

pDE.Username = UserName;

pDE.Password = Password;

pDE.Path = strPath;



DirectoryEntry pNewUser = pDE.Children.Add(strSEARCH_CN + pAccount.RDN,
pDE.SchemaClassName);



if (pNewUser != null)

{

pNewUser.Properties["objectClass"].Add("organizationalPerson");

pNewUser.Properties["objectClass"].Add("person");

pNewUser.Properties["objectClass"].Add("top");

}



pNewUser.Properties["rdn"].Add("joe.smith");

pNewUser.Properties["cn"].Add("smith, joe");

pNewUser.Properties["distinguishedName"].Add("cn=joe.smith,cn=mycontainer,ou
=mysite,o=myorganization");

pNewUser.Properties["rfc822Mailbox"].Add("(e-mail address removed)");

pNewUser.Properties["mail"].Add("(e-mail address removed)");



pNewUser.Properties["company"].Add("mycompany");

pNewUser.Properties["mailPreferenceOption"].Add(0);

pNewUser.Properties["department"].Add("mydepartment");

pNewUser.Properties["givenName"].Add("joe");

pNewUser.Properties["Home-MTA"].Add("cn=Microsoft
MTA,cn=myserver,cn=Servers,cn=Configuration,ou=mysite,o=myorganization");

pNewUser.Properties["uid"].Add("joe.smith"

pNewUser.Properties["MAPI-Recipient"].Add(true);

pNewUser.Properties["physicalDeliveryOfficeName"].Add("myofficename");

pNewUser.Properties["sn"].Add("smith");

pNewUser.Properties["title"].Add("mytitle");

pNewUser.Properties["telephoneNumber"].Add("123-1234");



pNewUser.CommitChanges();

pNewUser.Close();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top