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

该篇文章没有任何评论。

发表评论

内容

取消回复

推荐文章

Sharktech鲨鱼服务器商提供洛杉矶独立服务器促销 不限流量月99美元

Sharktech(鲨鱼服务器商)我们还是比较懂的,有提供独立服务器和高防服务器,而且性价比都还算是不错,而且我们看到有一些主机商的服务器也是走这个商家渠道分销的。这不看到鲨鱼服务器商家洛杉矶独立服务器纷纷促销,不限制流量的独立服务器起步99美元,这个还未曾有过。第一、鲨鱼机房服务器方案洛杉矶机房,默认1Gbps带宽,不限流量,自带5个IPv4,免费60Gbps / 48Mpps DDoS防御。C...

王小玉网-美国洛杉矶2核4G 20元/月,香港日本CN2 2核2G/119元/季,美国300G高防/80元/月!

 活动方案:美国洛杉矶 E5 2696V2 2核4G20M带宽100G流量20元/月美国洛杉矶E5 2696V2 2核4G100M带宽1000G流量99元/季香港CN2 E5 2660V2 2核2G30M CN2500G流量119元/季日本CN2E5 2660 2核2G30M CN2 500G流量119元/季美国300G高防 真实防御E5 2696V2 2核2G30M...

妮妮云香港CTG云服务器1核 1G 3M19元/月

香港ctg云服务器香港ctg云服务器官网链接 点击进入妮妮云官网优惠活动 香港CTG云服务器地区CPU内存硬盘带宽IP价格购买地址香港1核1G20G3M5个19元/月点击购买香港2核2G30G5M10个40元/月点击购买香港2核2G40G5M20个450元/月点击购买香港4核4G50G6M30个80元/月点击购买香...

空间邮箱为你推荐
留学生认证留学生前阶段双认证认证什么内容?李子柒年入1.6亿魔兽rpg箱庭世界1.6怎么进入魔门xyq.163.cbg.com梦幻西游藏宝阁百花百游百花净斑方效果怎么样?百度关键词工具如何利用百度关键词推荐工具选取关键词mole.61.com谁知道摩尔庄园的网址啊www.k8k8.com谁能给我几个街污网站我去自己学朴容熙这个人男的女的,哪国人。叫什么。月风随笔赏月之后的情感?语文随笔200-400字干支论坛干支计时的干支计时
免费域名空间 优惠码 idc评测网 php免费空间 qq数据库下载 域名转向 河南m值兑换 hostloc idc是什么 空间首页登陆 移动服务器托管 备案空间 电信网络测速器 酸酸乳 腾讯数据库 上海联通 九零网络 塔式服务器 免费的加速器 时间服务器 更多