Hello,
I have developed some web services in .net that allow users to auto provision their own Email accounts in Exchange. Users can create, enable, and disable their own user accounts and resources. I have based my code on examples using resources such as:
http://knicksmith.blogspot.com/2007/03/managing-exchange-2007-recipients-with.html
I am sure you are aware of this and other resources.
My web services work great; however, I am trying to incorporate Unified Messaging enabling/disabling into my web services. I assumed it would work just like the normal exchange cmdlets, but every time I try to execute a Unified Messaging cmdlet from .net c# I get this error message:
System.Management.Automation.CmdletInvocationException: Unable to find assembly 'Microsoft.Exchange.Data.Directory, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. ---> System.Runtime.Serialization.SerializationException: Unable to find assembly 'Microsoft.Exchange.Data.Directory, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage methodCallMessage)
at Microsoft.Exchange.Data.CloneHelper.SerializeObj(Object o)
at Microsoft.Exchange.Data.Directory.ADRawEntry.Clone()
at Microsoft.Exchange.UM.Rpc.UMRpcRequest..ctor(ADUser user)
at Microsoft.Exchange.UM.Rpc.ValidateOrGeneratePINRequest..ctor(ADUser user)
at Microsoft.Exchange.UM.Management.Tasks.UMMailboxTask.ValidateOrGeneratePIN(String pin)
at Microsoft.Exchange.UM.Management.Tasks.EnableUMMailbox.DoValidate()
at Microsoft.Exchange.UM.Management.Tasks.UMMailboxTask.InternalValidate()
at Microsoft.Exchange.Configuration.Tasks.Task.ProcessRecord()
at System.Management.Automation.Cmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
--- End of inner exception stack trace ---
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)
at System.Management.Automation.Internal.PipelineProcessor.Execute(Array input)
at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()
I don’t know why it is not finding the assembly. I found it myself on the server in the folder:
C:\Program Files\Microsoft\Exchange Server\Bin
I tried installing the assembly to the Global assembly directory: C:\WINDOWS\assembly
But then the Exchange management powershell snapin (Microsoft.Exchange.Management.PowerShell.Admin) will not load at all.
I then tried adding the assembly as a reference directly in my code, but then I get this error message:
System.Management.Automation.CmdletInvocationException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Exchange.UM.Management.Tasks.UMMailboxTask.ValidateOrGeneratePIN(String pin)
at Microsoft.Exchange.UM.Management.Tasks.EnableUMMailbox.DoValidate()
at Microsoft.Exchange.UM.Management.Tasks.UMMailboxTask.InternalValidate()
at Microsoft.Exchange.Configuration.Tasks.Task.ProcessRecord()
at System.Management.Automation.Cmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
--- End of inner exception stack trace ---
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)
at System.Management.Automation.Internal.PipelineProcessor.Execute(Array input)
at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()
Has anyone done Unified Messaging cmdlets with .net? Does anyone know how to get it to work in .net or be able to tell me what I am doing wrong? The other exchange cmdlets work great, and the UM cmdlets work fine directly from powershell. Thanks for your help.