首页 新闻 会员 周边 捐助

C#创建Exchange邮件遇到的问题

0
悬赏园豆:10 [已关闭问题] 关闭于 2008-05-21 11:18
<P>在园里看到有相关创建邮箱的资料。不过有一个问题请教大家。希望知道的回答一下。谢谢。下面是一段代码。其中&nbsp;&nbsp;<FONT color=#ff0000>"CN=GWBN," 中的GWBN代表什么</FONT>?看了几个人的LDAPL路径格式都不能看出这个具体应该填写什么。</P> <P>/// &lt;summary&gt;<BR>/// 创建邮箱<BR>/// &lt;/summary&gt;<BR>/// &lt;param name="strADSIUserPath"&gt;用户LDAP路径&lt;/param&gt;<BR>/// &lt;param name="strExchServer"&gt;Exchange服务器名&lt;/param&gt;<BR>/// &lt;param name="strDomainName"&gt;域名&lt;/param&gt;<BR>private static bool CreateCDOEXMailBox(string strADSIUserPath, string strExchServer, string strDomainName)<BR>{<BR>&nbsp;bool rv = false;<BR>&nbsp;try<BR>&nbsp;{<BR>&nbsp;&nbsp;string mdbURL = ADPath + "/" +<BR>&nbsp;&nbsp;"CN=邮箱存储("+ strExchServer + ")," +<BR>&nbsp;&nbsp;"CN=第一个存储组," +<BR>&nbsp;&nbsp;"CN=InformationStore," +<BR>&nbsp;&nbsp;"CN="+ strExchServer + "," +<BR>&nbsp;&nbsp;"CN=Servers," +<BR>&nbsp;&nbsp;"CN=第一个管理组," +<BR>&nbsp;&nbsp;"CN=Administrative Groups," +<BR>&nbsp;&nbsp;"CN=GWBN," + <BR>&nbsp;&nbsp;"CN=Microsoft Exchange," +<BR>&nbsp;&nbsp;"CN=Services," +<BR>&nbsp;&nbsp;"CN=Configuration," +strDomainName;<BR>&nbsp;&nbsp;Type objMailType = Type.GetTypeFromProgID("CreateMail.CreateExMail");<BR>&nbsp;&nbsp;Object objMail = Activator.CreateInstance(objMailType);<BR>&nbsp;&nbsp;Object[] myArg = {strADSIUserPath,mdbURL};<BR>&nbsp;&nbsp;object objAddStatus,objErrorInfo;<BR>&nbsp;&nbsp;objAddStatus = objMailType.InvokeMember("CreateCDOEXMailBox",BindingFlags.InvokeMethod,null,objMail,myArg);<BR>&nbsp;&nbsp;objErrorInfo = objMailType.InvokeMember("errorInfo",BindingFlags.GetProperty, null, objMail, new object[]{});<BR>&nbsp;&nbsp;rv = true;<BR>&nbsp;}<BR>&nbsp;catch(Exception ex)<BR>&nbsp;{<BR>&nbsp;&nbsp;if(ex.InnerException != null)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;ex = ex.InnerException;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;Trace.WriteLine(ex.ToString());<BR>&nbsp;}<BR>&nbsp;return rv;<BR>}<BR>注意如果你使用的exchange2003,则mdbURL不需改变,如果不是,则mdbURL变量你需要改一下。</P>
迭_戈的主页 迭_戈 | 初学一级 | 园豆:147
提问于:2008-01-23 16:29
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册