I’ve been digging in to the basics of using Exchange Web Services recently and thought it worthy of a few blog posts. These won’t be the perfectly crafted literary masterpieces of the Hanselmans of the world, but rather brain farts and code dumps to play with. The EWS SDK can be found here.
I suggest using Linqpad to run these code snippets as that is where they are being written.
Just add a reference to C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll and a using statement for Microsoft.Exchange.WebServices.Data and you’re good to go.
Sending an email using EWS is astonishingly simple and consists of just 8 lines of code: