稻草C 怎样给AD用户建立Exchange邮箱(不用CDOEXM)(转)_涅磐飞升的空间_百度空间(C how to AD users to establish a Exchange mailbox (not CDOEXM) (to) _ Nirvana soaring space _ Baidu space)

空间邮箱  时间:2021-03-03  阅读:()

C#怎样给AD用户建立Exchange邮箱(不用CDOEXM) (转)_涅磐飞升的

空间_百度空间C# how to AD users to establish a Exchangemailbox (not CDOEXM) (to) _ Nirvana soaring space _ Baiduspace

C#how to AD users to establish a Exchange mailbox (not CDOEXM)(turn) space Baidu space _Username: Password: _ Nirvanasoaring soaring space home page login Nirvana

Blogs, albums, personal files, good friends

View Article

How does C#create Exchange mailboxes (not CDOEXM) for AD users?2010-08-31 23:48

These days have also been CDOEXM torture a, in accordance withthe following standard method of MSDN, add bird reference toCDOEXM, and my cdo.dll, cdoexm.dll are exchange

2000 work on the server copy down, and then use the followingMSDN to provide the code, reported wrong, always reported wrong,a road to the black newspaper error! Say yes:

System.Runtime. InteropServices.COMException (0x80072030) :there is no such object on the server.

Mailbox = (IMailboxStore) user.NativeObject;

Mailbox.CreateMailbox (homeMDB) ;

User.CommitChanges () ;

I can be sure that the homeMDB extended attribute value mustbe wrong, because it is derived directly from Microsoft' s ownwindows vbs script system to a text file, vbs script, behindwill use the export homeMTA and msExchHomeServerName

StrBranchName= "OU name 1, OU=OU name 0, OU= company OU"""There is only one mailbox user below the Ou of the upper layersof the path. "

StrDC= "gdmailclus1"' IIS server name

StrDomain= "DC=mail, DC=xxxx", 'AD server, DN

S trLDAP=, "<LDAP://", "+s trDC+", "/OU=", "+st rBranchName+","+strDomain+" >"

Set oLDAPConn = CreateObject ("AdoDB.Connection")

OLDAPConn.Provider = "AdsDSOObj ect""

OLDAPConn.open

Set oCmd = CreateObject ("AdoDB.Command")

OCmd.ActiveConnecti on = oLDAPConn

OCmd.CommandT ext =

"StrLDAP+"; (objectCategory=Person) ; Distingui shedName; mail;SubTree"

Set oResult = oCmd.Execute

Set FSO=Wscript.CreateObject ("Scripting.FileSystemObject")"Set f = fso.CreateTextFile" ("C:\Documents and"

Sett ings\szadmin\ desktop \homeMDB.txt ""

StrGetUser= "LDAP://", "+strDC+" / "+oResult.Fields (0)"Set oUser = GetObject (strGetUser)

'wscript.echo

StrGetUser+vbcrlf+ "name:", "+oUser.name+vbcrlf+",

"sAMAccountName:", "+oUser. sAMAccountName+vbcrlf+",

"serverName:", "+oUser. serverName+vbcrl f+", "Mai l:",

"+oUser.Ma i l"

F.Wr iteLine (oUs er.homeMDB)

'wscript.echo oUser.homeMDB

'wscript.echo oUser.homeMTA

'wscript.echo oUser.mailNickName

'wscript.echo oUser.msExchUserAccountControl

'wscript.echo oUser.msExchHomeServerName

'wscript.echo oUser.mDBUseDefaults

'wscript.echo oUser.mail

F.close

Moreover, I can not work in the exchange server on thedevelopment environment, can not debug, and had to find a wayonline. Later on the Internet finally found, the originalCDOEXM in C# is not good, the conversion step error, adjustinga GetObject VB.net method on the OK, I also like the same problem,that is to the changed VB.net well.

God, I completely fainted at this point, the admiration ofMicrosoft, once again rising birds, are their own East and West,can do so. .

Fortunately, later found in a thread inside the method, theoriginal need not CDOEXM this rotten Dongdong, you can completethe construction of exchange mailbox work, directly write a fewAD extensions properties can be birds, the code is as follows:User.Properti es["homeMDB"] .Value=homeMDB;

User.Properti es["homeMTA"] .Value=homeMTA;

User.Properties["mailNickName", "] .Add" (dr["UserID",

"] .ToString") ;

User.Properties["msExchUserAccountControl", ] .Add (0) ;User.Properti es["msExchHomeServerName", "] .Add"

("/o=MAIL001/ou=mai ladmin/cn=Configurat ion/cn=Servers/cn=Mai l-SERVER") ;

User.Properti es["mDBUseDefaults", "] .Add" ("TRUE") ;

User.CommitChanges () ;

User is a DirectoryEntry object instance that you find, and Dris a DataRow in the input data set

HomeMDB, homeMTA, and msExchHomeServerName can be obtainedfrom the server using the above vbs script, and thestrBranchName in the script is changed to suit you

These three parameters of mine are as follows:

Private, string, homeMDB =

"CN=BE-SG2-MDB1, CN=GDMAI L-SG2, CN=I nformat i onSt ore,

CN=GDMAILEXCH, CN=Servers, CN=, the first management group,CN=Administrative

Groups, CN=xxxxORG, CN=Mi crosof t

Exchange, CN=Services, CN=Conf i gurat ion, DC=mai l, DC=xxxx";

Private string homeMTA = "CN=Microsoft"

MTA, CN=GDMAILEXCH, CN=Servers, CN=, the f irst managementgroup, CN=Admini strative

Groups, CN=xxxxORG, CN=Mi crosof t

Exchange, CN=Services, CN=Conf i gurat ion, DC=mai l, DC=xxxx";Private, string, msExchHomeServerName =

"/o=GMCCORG/ou=GDMAILEXAG/cn=Conf i gurat ion/cn=Servers/cn=GDMAILEXCH. "";

Trying to write the mail attribute in our work environment doesnot cause a constraint conflict exception, so you can changethe default mail address in batches by another VBS script.Change the default mail address of VBS:

StrBranchName= "Shenzhen branch""

S trBranchDoma in= "s z. ""

StrAll= "gd.xxxx.com""

StrDC= "gdmailclus1""

StrDomain= "DC=mai l, DC=xxxx. ""

S trLDAP=, "<LDAP://", "+s trDC+", "/OU=", "+st rBranchName+",

"+strDomain+" >"

Set oLDAPConn = CreateObject ("AdoDB.Connection")

OLDAPConn.Provider = "AdsDSOObj ect""

OLDAPConn.open

Set oCmd = CreateObject ("AdoDB.Command")

OCmd.ActiveConnecti on = oLDAPConn

OCmd.CommandT ext =

"StrLDAP+"; (objectCategory=Person) ; Distingui shedName; mail;SubTree"

Set oResult = oCmd.Execute

Wscript.echo oResult.Recordcount

While not oResult.EOF

StrGetUser= "LDAP://", "+strDC+" / "+oResult.Fields (0)"Set oUser = GetObject (strGetUser)

'wscript.echo oUser.name

OldMai l=oUser.mai l

If (Len (OldMail) >0) Then

OldPrimaryEmai l=Join (oUser.proxyAddres ses, "!")

INotChange=inStr (OldPrimaryEmai l, SMTP: , +oUser. )

“@” strbranchdomain sAMAccountName + + +稻草

如果inotchange = 0然后oldprimaryemai l =取代ol dprimaryemai l “即”  “即” oldprimaryemail =取代oldprimaryemail ”即“+ ouser。sAMAccountName + “@” + strbranchdomai n +稻草 ”即“+ ouser。sAMAccountName + “@” + strbranchdoma in +稻草newmai l = ouser。 sAMAccountName + “@” + strbranchdomain +稻草

“wscript. echo”邮件 “+ newmail

“wscript. echo”代理 “+ oldprimaryemailstrproxy =分裂oldprimaryemail “ ” ouser。 msexchpoliciesexcluded

= “{ 26491cfc-9e50-4857-861b-0cb8df22b5d7 }”

“ouser msexchpoliciesexcluded = vbnull。ouser邮件= newmai l。

ouser ProxyAddresses = strproxy。ouser. setinfo

最后如果

最后如果oresult.movenext

走wscript.echo “完成”

上一篇> > C #创建交换邮箱问题请教高„下一篇> > c doexm操作转kaneboy

类别 A SP.NET | |添加到搜藏|分享到我贴吧|浏览474 |评论网友评论

该篇文章没有任何评论。

发表评论

内容

取消回复

推荐文章

CYUN(29元/月)美国、香港、台湾、日本、韩国CN2,续费原价

关于CYUN商家在之前有介绍过一次,CYUN是香港蓝米数据有限公司旗下的云计算服务品牌,和蓝米云、蓝米主机等同属该公司。商家主要是为个人开发者用户、中小型、大型企业用户提供一站式核心网络云端部署服务,促使用户云端部署化简为零,轻松快捷运用云计算。目前,CYUN主要运营美国、香港、台湾、日本、韩国CN2线路产品,包括云服务器、站群服务器和独立服务器等。这次看到CYUN夏季优惠活动发布了,依然是熟悉的...

Webhosting24:€15/年-AMD Ryzen/512MB/10GB/2TB/纽约&日本&新加坡等机房

Webhosting24是一家始于2001年的意大利商家,提供的产品包括虚拟主机、VPS、独立服务器等,可选数机房包括美国洛杉矶、迈阿密、纽约、德国慕尼黑、日本、新加坡、澳大利亚悉尼等。商家VPS主机采用AMD Ryzen 9 5950X CPU,NVMe磁盘,基于KVM架构,德国机房不限制流量,网站采用欧元计费,最低年付15欧元起。这里以美国机房为例,分享几款套餐配置信息。CPU:1core内存...

久久网云-目前最便宜的国内,香港,美国,日本VPS云服务器19.9元/月起,三网CN2,2天内不满意可以更换其他机房机器,IP免费更换!。

久久网云怎么样?久久网云好不好?久久网云是一家成立于2017年的主机服务商,致力于为用户提供高性价比稳定快速的主机托管服务,久久网云目前提供有美国免费主机、香港主机、韩国服务器、香港服务器、美国云服务器,香港荃湾CN2弹性云服务器。专注为个人开发者用户,中小型,大型企业用户提供一站式核心网络云端服务部署,促使用户云端部署化简为零,轻松快捷运用云计算!多年云计算领域服务经验,遍布亚太地区的海量节点为...

空间邮箱为你推荐
美国互联网瘫痪2000年美国的互联网危机事件的原因?地图应用用哪个地图导航最好最准蓝色骨头手机蓝色骨头为什么还没上映bbs.99nets.com做一款即时通讯软件难吗 像hi qq这类的lunwenjiancepaperfree论文检测安全吗陈嘉垣大家觉得陈嘉桓漂亮还是钟嘉欣漂亮?百度关键词工具常见百度关键词挖掘方法分别是什么请列举?长尾关键词挖掘工具怎么挖掘长尾关键词,可以批量操作的那种m.kan84.net电视剧海派甜心全集海派甜心在线观看海派甜心全集高清dvd快播迅雷下载www.6vhao.com有哪些电影网站
免费域名注册网站 php主机空间 香港vps主机 主机评测 enzu fastdomain yardvps windows主机 外国服务器 cloudstack nerd 42u机柜尺寸 网站保姆 北京双线机房 新家坡 100m独享 php空间购买 息壤代理 流媒体加速 上海电信测速网站 更多