none
Create Exchange Mailbox in C# code without having Exchange on box RRS feed

  • Question

  • I'm developing a .Net form that can be filled out to add new employees to AD and create a mailbox in Exchange.  The problem is, we do not and cannot have Exchange installed on the server we are running the form from.  From what I've read, it looks like you must have Exchange installed on the server for this to work.  My question is, is there no work-around to this?  We only want someone from IT to have the ability to create the mailbox so my only though of a work-around would be to somehow check to see if the user has the Exchange Management Console installed and run the code if they do and show an error message if not.  Problem with that is, I'm also not sure how to check for this in my code.

     

    Monday, January 24, 2011 9:36 PM

All replies

  • You didn't say what version of Exchange this code must work against - it makes a difference!  If it's Exchange 2007, you will have to have the Exchange Management Tools installed.  If Exchange 2010, you can make sure the box where your code runs has Powershell 2.0 installed, and you can then issue remote commands to the Exchange world via Powershell Remoting.

     

    However, since you appear to be just getting started in Exchange development AND you seem to be coding an in-house app, I would suggest you simply have the Exchange Management Tools installed - it will make coding against Exchange using EWS much easier.

     

    As for determining if the EMT are installed, I use Powershell - I execute the following cmdlet (from .Net code):

     

    Get-PSSnapIn -Registered

     

    if the EMT for Exchange 2007 are installed, you'll get back this string (among others):

       Microsoft.Exchange.Management.PowerShell.Admin

     

    And if the EMT for Exchange 2010 are installed, this will be returned:

      Microsoft.Exchange.Management.PowerShell.E2010

     

     

    Rob

     

    Monday, January 24, 2011 11:48 PM