与EXCHANGE有关 會的絕對是高人
麻煩解釋一個 以下添加郵件帳號和NT帳號的含義
ExchangeAcctLib.AcctMgmt objAcct = new MSExchangeAcctLib.AcctMgmtClass();
object obSID;
object obSD;
string strDCT = "2A864886F7140501 ";
objAcct.GetSidFromName(strDomain,strUsername,out obSID);
objMailbox.Properties[ "Assoc-NT-Account "].Add(obVal);
objAcct.GenerateSecDescriptor(strDomain,strUsername, out obSD);
objMailbox.Properties[ "NT-Security-Descriptor "].Add(obSD);
objMailbox.Properties[ "Deliv-Ext-Cont-Types "].Add(strDCT);
objMailbox.CommitChanges();
objMailbox.Close();
用以下程式實現的功能是點擊BUTTON 會增加一個賬號
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using MSExchangeAcctLib;
using System.DirectoryServices;
namespace exchangetest
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
///
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
public MSExchangeAcctLib.AcctMgmt objAcct = new MSExchangeAcctLib.AcctMgmtClass();
public object obSID;
public object obSD;
public string strDCT = "2A864886F7140501 ";
private void Button1_Click(object sender, System.EventArgs e)
{
objAcct.NtAccountCreate( "utpcb ", "testtest ", "123 ", " ", "5310PC ");
}
private void Page_Load(object sender, System.EventArgs e)
{
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
出現以下錯誤
Server Error in &