Announcement

Collapse
No announcement yet.

error crateing mailbox under asp.net in c#

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • error crateing mailbox under asp.net in c#

    hello all,

    I have different problems creating an exchange 2000 mailbox for an ads
    user with c#. I have a domain controller and an exchange mailbox store
    who are different and the iis is also another server. all three are in
    the same ADS domain. The Home MDB string is entirely correct because
    I've copied it directly from ADSIedit. I've also changed my web.config
    to impersonate so that the script runs under a domain user. This user
    has also the 'Act as part of the operating system' privilidges and the
    administrator rights on the exchange server.
    I thought I#ve made everything correct but I still get the following
    error messages. Can anybody help???
    <pre>
    ----------------------------------------------------
    The following error occurs:

    Exception Details: System.ArgumentException: The parameter is
    incorrect.

    Source Error:

    An unhandled exception was generated during the execution of the
    current web request. Information regarding the origin and location of
    the exception can be identified using the exception stack trace below.

    Stack Trace:

    [ArgumentException: The parameter is incorrect.]
    CDOEXM.IMailboxStore.CreateMailbox(String HomeMDBURL) +0
    WebApplication2.WebForm1.Page_Load(Object sender, EventArgs e)
    System.Web.UI.Control.OnLoad(EventArgs e) +67
    System.Web.UI.Control.LoadRecursive() +29
    System.Web.UI.Page.ProcessRequestMain() +724
    ------------------------------------------
    This is my source code:

    IADsUser objUser;
    CDOEXM.IMailboxStore mailbox;
    DirectoryEntry newuser =
    de.Children.Add("CN="+Request.Form["displayname"],"User");

    newuser.Properties["sAMAccountName"].Add(Request.Form["displayname"]);
    newuser.Properties["userAccountControl"].Value=0x200;
    newuser.CommitChanges();

    objUser= (ActiveDs.IADsUser) newuser.NativeObject;
    objUser.AccountDisabled=false;
    objUser.SetInfo();
    objUser.ChangePassword("","xxx");
    objUser.FullName="Testing User";
    newuser.CommitChanges();
    objUser.SetInfo();

    mailbox = (CDOEXM.IMailboxStore)objUser;
    string homeMDB = "LDAP://ADCSERVER.DOMAIN.NET/CN=Mailbox Store
    (EXCHANGE_STORE),CN=First Storage
    Group,CN=InformationStore,CN=EXCHANGE_STORE,CN=Ser vers,CN=Administrative
    Groups,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=DOMAIN,DC =NET";

    mailbox.CreateMailbox(homeMDB);
    objUser.SetInfo();
    -----------------------------------
    </pre>
    thanks,

    niels
Working...
X