I'm new to using EWS (Exchange Web Service) and I'm looking for a simple example that demonstrates how to send an email with an attachment. I've searched for an example and I can't find any that are simple and clear-cut. I've found examples about how to send an email but not sending an email with an attachment.
Does anyone have a link to an example they would recommend? Posting an example here would work just as well!
Best Answer
Well, I eventually figured this out. Here is a method that will create a mail message, store it as a draft, add the attachment and then send the email. Hope this helps someone out there who wasn't able to find a good example like me.
In my example, I'll only be sending excel files which is why the content type is set like it is. This can, obviously, be changed to support any type of file attachment.
For your reference, the variable esb is a class level variable of type ExchangeServiceBinding.
Edit
I should also note that in this example, I'm not checking the response types from the exchange actions for success or failure. This should definitely be checked if you care to know whether or not your calls to EWS actually worked.