I've been tasked with writing a SOAP web-service in .Net to be middleware between EWS2010 and an application server that previously used WebDAV to connect to Exchange. (As I understand it, WebDAV is going away with EWS2010, so the application server will no longer be able to connect as it previously did, and it is exponentially harder to connect to EWS without WebDAV. The theory is that doing it in .Net should be easier than anything else... Right?!)
My end goal is to be able to get and create/update email, calendar items, contacts, and to-do list items for a specified Exchange account. (Deleting is not currently necessary, but I may build it in for future consideration, if it's easy enough).
I was originally given some sample code, which did in fact work, but I quickly realized that it was outdated. The types and classes used appear nowhere in the current documentation.
For example, the method used to create a connection to the Exchange server was:
ExchangeService svc = new ExchangeService();
svc.Credentials = new WebCredentials(AuthEmailAddress, AuthEmailPassword);
svc.AutodiscoverUrl(AutoDiscoverEmailAddress);
For what it's worth, this was using an assembly that came with the sample code: Microsoft.Exchange.WebServices.dll ("MEWS").
Before I realized that this wasn't the current standard way to accomplish the connection, and it worked, I tried to build on it and add a method to create calendar items, which I copied from here:
static void CreateAppointment(ExchangeServiceBinding esb)
{
// Create the appointment.
CalendarItemType appointment = new CalendarItemType();
...
}
Right away, I'm confronted with the dif