none
Creating a mailbox in Exchange Online using C# in .netcore app RRS feed

  • Question

  • I'm able to achieve this in .net framework app using the tutorial- https://blogs.msdn.microsoft.com/wushuai/2016/09/18/access-exchange-online-by-powershell-in-c/

    This does not work in .netcore app. I get following error-

    System.TypeInitializationException: The type initializer for 'System.Management.Automation.Runspaces.RunspaceFactory' threw an exception. ---> System.TypeLoadException: Could not load type 'System.Diagnostics.Eventing.EventDescriptor' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
       at System.Management.Automation.Runspaces.RunspaceFactory..cctor()
       --- End of inner exception stack trace ---
       at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(RunspaceConnectionInfo connectionInfo)
       at DisposableDemo.ConsolePS.ExchangeOnlinePS.ExecuteCommand(List`1 commands) 

    .................

    Please let me know how can this be resolved.

    Saturday, June 22, 2019 6:47 AM

All replies

  • I'm able to achieve this in .net framework app using the tutorial- https://blogs.msdn.microsoft.com/wushuai/2016/09/18/access-exchange-online-by-powershell-in-c/

    This does not work in .netcore app. I get following error-

    System.TypeInitializationException: The type initializer for 'System.Management.Automation.Runspaces.RunspaceFactory' threw an exception. ---> System.TypeLoadException: Could not load type 'System.Diagnostics.Eventing.EventDescriptor' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
       at System.Management.Automation.Runspaces.RunspaceFactory..cctor()
       --- End of inner exception stack trace ---
       at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(RunspaceConnectionInfo connectionInfo)
       at DisposableDemo.ConsolePS.ExchangeOnlinePS.ExecuteCommand(List`1 commands) 

    .................

    Please let me know how can this be resolved.

    As discussed in ASP.NET Core forum you may have a compatibility issue between non Core libraries and .NET Core.

    You can check with Office developers for father possible insight.

    https://social.msdn.microsoft.com/forums/office/en-us/home?category=officedev

    Sunday, June 23, 2019 3:04 AM
  • I'm able to achieve this in .net framework app using the tutorial- https://blogs.msdn.microsoft.com/wushuai/2016/09/18/access-exchange-online-by-powershell-in-c/

    This does not work in .netcore app. I get following error-

    System.TypeInitializationException: The type initializer for 'System.Management.Automation.Runspaces.RunspaceFactory' threw an exception. ---> System.TypeLoadException: Could not load type 'System.Diagnostics.Eventing.EventDescriptor' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
       at System.Management.Automation.Runspaces.RunspaceFactory..cctor()
       --- End of inner exception stack trace ---
       at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(RunspaceConnectionInfo connectionInfo)
       at DisposableDemo.ConsolePS.ExchangeOnlinePS.ExecuteCommand(List`1 commands) 

    .................

    Please let me know how can this be resolved.

    As discussed in ASP.NET Core forum you may have a compatibility issue between non Core libraries and .NET Core.

    You can check with Office developers for father possible insight.

    https://social.msdn.microsoft.com/forums/office/en-us/home?category=officedev

    Will do that. Thanks!
    Sunday, June 23, 2019 3:09 AM