locked
Create exchange mailbox in c# 2008 RRS feed

  • Question

  • In VB 2005 I used to create a mailbox for a user during the user creation by doing an addrequest with a directory entry. I would add in these 2 direcotry entries to the addrequest


            Dim userhomeMDB As New DirectoryAttribute("homeMDB", txtuserhomeMDB)
            Dim usermsExchHomeServerName As New DirectoryAttribute("msExchHomeServerName", txtusermsExchHomeServerName)

    and viola! a mailbox would be created with the user.

    I am now switching to C# 2008 and am creating the user by extending UserPrincipal to include a bunch of extra properties (I will include some samples below) and principalcontext. To make a long story short, so far the only extra properties that are causing issues are the 2 listed above. Here are what they look like in the extended version of UserPrincipal.

    /// Gets or sets the homeMDB (exchange) value for this principal

    [DirectoryProperty("homeMDB")]

    public string homeMDB

    {

    get

    {

    object[] result = this.ExtensionGet("homeMDB");

    return GetStringFromExtensionResults(result);

    }

    set

    {

    this.ExtensionSet("homeMDB", value);

    }

    }

    /// Gets or sets the msExchHomeServerName (exchange) value for this principal

    [DirectoryProperty("msExchHomeServerName")]

    public string msExchHomeServerName

    {

    get

    {

    object[] result = this.ExtensionGet("msExchHomeServerName");

    return GetStringFromExtensionResults(result);

    }

    set

    {

    this.ExtensionSet("msExchHomeServerName", value);

    }

    }

    I don't think the syntax is the issue. I have a good 20-30 other attributes such as mailNickname, postalCode, extendedAttribute1 that all work just fine, but as soon as I try to create the user with the 2 exchange attributes it blows up. Anyway, is anyone else doing something similar or is there a recommended way to create exchange mailboxes in 2008? I am really striking out on Google for someone else that is doing this. The exchange version is 2003.

    Thanks


    JG
    • Edited by JohnGisi Monday, August 4, 2008 8:37 PM forgot exchange version
    • Moved by jack 321 Thursday, August 7, 2008 8:57 AM not a C# general question (Moved from Visual C# General to Off-Topic Posts (Do Not Post Here))
    Monday, August 4, 2008 5:15 PM

Answers