问题描述
Exchange2003,首先用下面的代码,自动创建用户ABC,然后用WebDAV去访问http://localhost/exchange/ABC/,出现错误:Theremoteserverreturnedanerror:(404)NotFound.但是,我用IE登陆http://localhost/exchange/ABC/,并输入用户名和密码后,能看到Exchange邮箱网页,关闭IE,之后再用WebDAV去访问http://localhost/exchange/ABC/就成功了。重新创建了几个新用户都是这样的现象。先不能用WebDAV访问,用IE登陆后再关闭,就能用WebDAV访问了。请问大家这是什么原因?是不是我用下面的代码创建的用户ABC有某些属性不对??大家帮忙看看,谢谢了!!!stringdefaultNC=ConfigurationManager.AppSettings["defaultNC"];stringalias="ABC";stringfullName="ABC"stringpassword="!@qaz123";stringhomeMDB=ConfigurationManager.AppSettings["homeMDB"];DirectoryEntrycontainer,user;CDOEXM.IMailboxStoremailbox;//Thiscreatesthenewuserinthe"users"container.//SetthesAMAccountNameandthepasswordcontainer=newDirectoryEntry("LDAP://cn=users,"+defaultNC);user=container.Children.Add("cn="+fullName,"user");user.Properties["sAMAccountName"].Add(alias);user.CommitChanges();user.Invoke("SetPassword",newobject[]{password});//Thisenablesthenewuser.user.Properties["userAccountControl"].Value=0x200;//ADS_UF_NORMAL_ACCOUNTuser.CommitChanges();//ObtaintheIMailboxStoreinterface,createthemailbox,andcommitthechanges.mailbox=(IMailboxStore)user.NativeObject;mailbox.CreateMailbox(homeMDB);user.CommitChanges();
解决方案
解决方案二:
没用过WebDAV,可以用WebService试试