public int CreatUser(string loginname)
{
string p_strDomainLoginName="admin";
string p_strDomainLoginPassword="";
string p_strDomainName="myweb.com";
string p_strDCName="DC=myweb,DC=com";
string p_strServerName="myweb";
int ReturnValue;
CDO.PersonClass pcUser;
CDOEXM.IMailboxStore MailBox;
string strLDAP="LDAP://" + p_strDomainName + "/CN=" + loginname + ",CN=users," + p_strDCName;
string strHomeMDBURL="LDAP://" + p_strDomainName + "/CN=Mailbox Store (" + p_strServerName + ")," +
"CN=First Storage Group,CN=InformationStore," +
"CN=" + p_strServerName + ",CN=Servers,CN=First Administrative Group," +
"CN=Administrative Groups,CN=First Organization," +
"CN=Microsoft Exchange,CN=Services,CN=Configuration," + p_strDCName;
if (loginname.Length>0)
{
try
{
//增加用户
pcUser=new PersonClass();
pcUser.FirstName=loginname;
pcUser.LastName="";
pcUser.Fields["userAccountControl"].Value=66048; //设置该用户密码永不过期
pcUser.Fields["userPrincipalName"].Value=loginname; //设置用户的登录帐号
&nb