稻草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 |评论网友评论

该篇文章没有任何评论。

发表评论

内容

取消回复

推荐文章

杭州王小玉网-美国CERA 2核8G内存19.9元/月,香港,日本E3/16G/20M CN2带宽150元/月,美国宿主机1500元,国内宿主机1200元

官方网站:点击访问王小玉网络官网活动方案:买美国云服务器就选MF.0220.CN 实力 强 强 强!!!杭州王小玉网络 旗下 魔方资源池 “我亏本你引流活动 ” mf.0220.CNCPU型号内存硬盘美国CERA机房 E5 2696v2 2核心8G30G总硬盘1个独立IP19.9元/月 续费同价mf.0220.CN 购买湖北100G防御 E5 2690v2 4核心4G...

ManSora:英国CN2 VPS,1核/1GB内存/10GB SSD/1TB流量/100Mbps/KVM,$18.2/月

mansora怎么样?mansora是一家国人商家,主要提供沪韩IEPL、沪日IEPL、深港IEPL等专线VPS。现在新推出了英国CN2 KVM VPS,线路为AS4809 AS9929,可解锁 Netflix,并有永久8折优惠。英国CN2 VPS,$18.2/月/1GB内存/10GB SSD空间/1TB流量/100Mbps端口/KVM,有需要的可以关注一下。点击进入:mansora官方网站地址m...

spinservers:10Gbps带宽高配服务器月付89美元起,达拉斯/圣何塞机房

spinservers是一家主营国外服务器租用和Hybrid Dedicated等产品的商家,Majestic Hosting Solutions LLC旗下站点,商家数据中心包括美国达拉斯和圣何塞机房,机器一般10Gbps端口带宽,且硬件配置较高。目前,主机商针对达拉斯机房机器提供优惠码,最低款Dual E5-2630L v2+64G+1.6TB SSD月付89美元起,支持PayPal、支付宝等...

空间邮箱为你推荐
存储备份手机备份到内部存储安徽汽车网安徽汽车票查询微信回应封杀钉钉微信违规操作被封了,中老铁路一带一路的火车是什么火车蓝色骨头手机都是人类的骨头灰歌名是什么嘉兴商标注册怎么查商标注册日期同一ip网站如何用不同的IP同时登陆一个网站同ip站点同IP网站具体是什么意思,能换独立的吗haole10.comwww.qq10eu.in是QQ网站吗www.henhenlu.com有一个两位数,十位数字是个位数字的二分之一,将十位数字与个位数字对调,新的两位数比原来大36,这个两位数
万网域名 如何注册域名 enom 联通c套餐 站群服务器 koss 68.168.16.150 监控宝 网通ip 蜗牛魔方 京东商城0元抢购 网通服务器托管 电信主机 789电视剧 google台湾 稳定空间 后门 .htaccess 侦探online 香港打折信息 更多