Willy Denoyette [MVP] wrote:
Please, post some more code, we can't help you when you don't give us the
LDAP URL in:
mailBox.CreateMailbox(..);
Hajo Willy, below I present my code.
DirectoryEntry users = new
DirectoryEntry("LDAP://10.7.0.10/CN=Users,DC=company,DC=local",
"CN=Administrator,CN=Users,DC=company,DC=local ",
"password", AuthenticationTypes.ServerBind);
DirectoryEntry user = users.Children.Add("cn=JanKowalski", "user");
user.CommitChanges();
user.Properties["samAccountName"].Value = "JanKowalski";
// enable user: 0x200 ADS_UF_NORMAL_ACCOUNT
// password never expires: 0x10000 ADS_UF_DONT_EXPIRE_PASSWD
user.Properties["userAccountControl"].Value = 0x200 | 0x10000;
user.Invoke("SetPassword", new Object[]{"@@#$%qweqwerA1"});
user.CommitChanges();
ActiveDs.IADsUser adsiUser = (ActiveDs.IADsUser)user.NativeObject;
adsiUser.AccountDisabled = false;
// THIS PART I CAN NOT EXECUTE FROM OUTSIDE OF THE DOMAIN
IMailboxStore mailBox = (IMailboxStore)user.NativeObject;
mailBox.CreateMailbox("CN=Mailbox Store (SPAMERSKI),CN=First Storage
Group,CN=InformationStore,CN=SPAMERSKI,CN=Servers, CN=First
Administrative Group,CN=Administrative Groups,CN=Software
Company,CN=Microsoft
Exchange,CN=Services,CN=Configuration,DC=company,D C=local");
user.CommitChanges();
thanks for quick reply
Gawel