none
Microsoft.Exchange.Management.Powershell - help finding command RRS feed

  • Question

  • Ok so in Exchange 2007 there is a checkbox "Hide from Exchange address books".

    Does anyone know how to enable/disable this with the Microsoft.Exchange.Management namespace? Here is a sample code snippet to enable a mailbox on a server:

    public static bool enableMailbox(string database, string identity)
    {
    bool success = false;
    try
    {
    RunspaceConfiguration config = RunspaceConfiguration.Create();
    PSSnapInException warning;

    //using exchange powershell snap-in to create mailbox
    config.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out warning);
    if (warning != null) throw warning;

    Runspace exRunSpace = RunspaceFactory.CreateRunspace(config);
    exRunSpace.Open();
    Pipeline exPipeline = exRunSpace.CreatePipeline();
    //these following three commands are the commands being passed to the powershell
    exPipeline.Commands.Add("Enable-Mailbox");
    exPipeline.Commands[0].Parameters.Add("Database", database);
    exPipeline.Commands[0].Parameters.Add("identity", identity);

    exPipeline.Invoke();
    exPipeline.Dispose();
    exRunSpace.Close();
    success = true;
    }
    catch (Exception e)
    {
    errorMessage = e.Message.ToString();
    }

    return success;
    }

    I don't really need the code, I just need to know the commands. Any help would be appreciated!
    Wednesday, August 5, 2009 7:15 PM

Answers

All replies