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

该篇文章没有任何评论。

发表评论

内容

取消回复

推荐文章

蓝速数据(58/年)秒杀服务器独立1核2G 1M

蓝速数据金秋上云季2G58/年怎么样?蓝速数据物理机拼团0元购劲爆?蓝速数据服务器秒杀爆产品好不好?蓝速数据是广州五联科技信息有限公司旗下品牌云计算平台、采用国内首选Zkeys公有云建设多种开通方式、具有IDC、ISP从业资格证IDC运营商新老用户值得信赖的商家。我司主要从事内地的枣庄、宿迁、深圳、绍兴、成都(市、县)。待开放地区:北京、广州、十堰、西安、镇江(市、县)。等地区数据中心业务,均KV...

DogYun春节优惠:动态云7折,经典云8折,独立服务器月省100元,充100送10元

传统农历新年将至,国人主机商DogYun(狗云)发来了虎年春节优惠活动,1月31日-2月6日活动期间使用优惠码新开动态云7折,经典云8折,新开独立服务器可立减100元/月;使用优惠码新开香港独立服务器优惠100元,并次月免费;活动期间单笔充值每满100元赠送10元,还可以参与幸运大转盘每日抽取5折码,流量,余额等奖品;商家限量推出一款年付特价套餐,共100台,每个用户限1台,香港VPS年付199元...

#推荐# cmivps:全场7折,香港不限流量VPS,支持Windows系统

cmivps香港VPS带来了3个新消息:(1)双向流量改为单向流量,相当于流量间接扩大一倍;(2)Hong Kong 2T、Hong Kong 3T、Hong Kong 无限流量,这三款VPS开始支持Windows系统,如果需要中文版Windows系统请下单付款完成之后发ticket要求官方更改即可;(3)全场7折年付、8折月付优惠,优惠码有效期一个月!官方网站:https://www.cmivp...

空间邮箱为你推荐
ip购买买一个电信的固定IP多少钱啊?固态硬盘是什么固态硬盘是什么?与普通硬盘有什么区别?移动硬盘与u盘有什么区别?access数据库ACCESS数据库和SQL有什么区别?比肩工场比肩接踵的意思psbc.com95580是什么诈骗信息不点网址就安全吧!8090lu.com8090看看电影网怎么打不开了郭泊雄郭佰雄最后一次出现是什么时候?www.zjs.com.cn中国快递公司排名avtt4.comwww.5c5c.com怎么进入baqizi.cc汉字的故事100字
域名代理 windows虚机 域名查询工具 申请免费域名 sugarhosts 西安电信测速 重庆服务器托管 payoneer 地址大全 个人空间申请 100m空间 新家坡 免费高速空间 linux使用教程 上海电信测速 智能dns解析 永久免费空间 如何登陆阿里云邮箱 存储服务器 accountsuspended 更多