G
Guest
I have the following code that creates a user and makes a mailbox with it:
private void kandidaatAanmaken(string voornaam, string achternaam, string
gebruikersnaam)
{
string password = "1234567";
DirectoryEntry container, user;
string homeMDB = "";
container = new DirectoryEntry("LDAP://192.168.0.56/CN=Users,
DC=aoicttest, DC=local");
user = container.Children.Add("cn="+voornaam+" "+achternaam, "user");
user.Properties["sAMAccountName"].Add(gebruikersnaam);
user.CommitChanges();
user.Invoke("SetPassword", new object[]{password});
user.Properties["UserAccountControl"].Value = 0x200;
user.CommitChanges();
//Group(wenskandidaten) opzoeken en de kandidaat aan de group
toevoegen
DirectoryEntry groupDE = new DirectoryEntry();
groupDE.Username = "administrator";
groupDE.Password = "1234567";
groupDE.Path = container.Path;
DirectoryEntry groupEntry =
groupDE.Children.Find("CN=wenskandidaten", "group");
groupEntry.Invoke("add", new object[] {user.Path});
CDOEXM.IMailboxStore mailbox;
homeMDB = "CN=Mailbox Store(aoicttestserver), CN=First Storage Group,"
+ "CN=InformationStore, CN=aoicttestserver, CN=Servers,"
+ "CN=First Administrative Group, CN=Administrative Groups,"
+ "CN=aoicttest ,CN=Microsoft Exchange, CN=Services,"
+ "CN=Configuration, DC=aoicttest, DC=local";
mailbox = (IMailboxStore)user.NativeObject;
mailbox.CreateMailbox(homeMDB);
user.CommitChanges();
}
Now, the creation of the user goes allright, but the creation of the mailbox
goes wrong. I have the following computername and domainname:
computername(full): aoicttestserver.aoicttest.local
domain: aoicttest.local
Please help me with this problem.
Arjen
private void kandidaatAanmaken(string voornaam, string achternaam, string
gebruikersnaam)
{
string password = "1234567";
DirectoryEntry container, user;
string homeMDB = "";
container = new DirectoryEntry("LDAP://192.168.0.56/CN=Users,
DC=aoicttest, DC=local");
user = container.Children.Add("cn="+voornaam+" "+achternaam, "user");
user.Properties["sAMAccountName"].Add(gebruikersnaam);
user.CommitChanges();
user.Invoke("SetPassword", new object[]{password});
user.Properties["UserAccountControl"].Value = 0x200;
user.CommitChanges();
//Group(wenskandidaten) opzoeken en de kandidaat aan de group
toevoegen
DirectoryEntry groupDE = new DirectoryEntry();
groupDE.Username = "administrator";
groupDE.Password = "1234567";
groupDE.Path = container.Path;
DirectoryEntry groupEntry =
groupDE.Children.Find("CN=wenskandidaten", "group");
groupEntry.Invoke("add", new object[] {user.Path});
CDOEXM.IMailboxStore mailbox;
homeMDB = "CN=Mailbox Store(aoicttestserver), CN=First Storage Group,"
+ "CN=InformationStore, CN=aoicttestserver, CN=Servers,"
+ "CN=First Administrative Group, CN=Administrative Groups,"
+ "CN=aoicttest ,CN=Microsoft Exchange, CN=Services,"
+ "CN=Configuration, DC=aoicttest, DC=local";
mailbox = (IMailboxStore)user.NativeObject;
mailbox.CreateMailbox(homeMDB);
user.CommitChanges();
}
Now, the creation of the user goes allright, but the creation of the mailbox
goes wrong. I have the following computername and domainname:
computername(full): aoicttestserver.aoicttest.local
domain: aoicttest.local
Please help me with this problem.
Arjen