PowerShell and Exchange with C#
When writing a program that needs to interact with Exchange (whether on-premises or off-premises/online), the easiest way is to use PowerShell commands. This is done by adding the following above your namespace declaration: using System.Management.Automation; The key thing that I have found to be a problem for C# programs using PowerShell is that occasionally you will receive an error message that says “A connection to the directory on which to process the request was unavailable. This is likely a transient…