About: Exchange Web Services (EWS) – Getting started with EWS


API Type:  Mailbox Assessor
API Interface: APIs which can send a POST. 
Business Logic: Works with  mailbox and public folder content including items, folders and special settings.
Development Languages: Anything which can send a post. So, you can write code for iOS, Droid, Windows forms, ASP.NET, JavaScript, PowerShell... 
Property Access:
Yes
Product Versions:
Exchange 2007, Exchange 2010, Exchange 2013, Exchange Online

Summary:

Exchange Web Services (EWS) is a very robust mailbox accessing API for working with the content of mailboxes.  It is does not due mailbox maintenance - Exchange PowerShell cmdlets are used for those types of operations.  There are many benefits in using EWS over other messaging APIs.  It code using EWS can be written from any language which can submit an HTTP/HTTPs request and can be done from any platform.

There are many ways to submit EWS requests.  The following are what are covered by Developer Support:

    • Raw EWS SOAP style POSTs
    • Visual Studio generated proxy classes.  Other proxy class generators are not supported.
      Generated proxies are used by some developers - there is a lot of code out there using them.  More code it seems uses the EWS Managed API.    Sometimes the EWS schema has changes made to it which may require code relying on generated proxy classes to be altered if the application's proxies get regenerated. While this is a viable approach to development, it is most often better to use the EWS Managed API.
    • Exchange EWS Managed API.
      The EWS Managed API is a .NET wrapper for doing EWS calls - it makes using EWS fairly simple.  However, this API does not cover all EWS calls. The code for this API is published on GIT.

Generated proxies are used by some developers - there is a lot of code out there using them.  More code it seems uses the Exchange EWS API.    If generated proxy classes or the EWS Managed API have issues or limitations you can always drop back to submitting EWS POSTs.

The EWS Managed API is a web-release API and is not tied to the release of a product.  So, there is no hot fix support.  You can file bugs for it on GIT or one can be filed if you open a case with Microsoft.  Since its open source you can also get the full source code and modify it to fit your needs.  You can also check in changes and if they are accepted they may be merged in.  If you are using this API and encounter issues and cannot work around it in your application code or by modifying the API then the fallback is to user a raw SOAP POST.

Some Points Of Interest:

  • Can be used with any language.
  • Works with Exchange 2007 and later.
  • Impersonation and delegation access are supported.
  • Basic, NTLM, Windows and oAuth can be used.
  • Code can run from a windows or web service, asp/asp.net page, windows application or any other client as long as a POST can be sent.
  • It can do most things that a client application would want.- its a very robust API.
  • Having the .Net connection limit too low will bottleneck your application.  If your application is other than a simple single user client application then you may likely need to increase this number to something other than the default.
  • Be sure to read-up on Exchange throttling - especially in areas around EWS.  Exchange throttling is for your server's protection, so clients need to be written to respect those settings - i.e. they need to self throttle if they would push back Exchange's throttling limits.
  • EWS has its own impersonation model. Thread impersonation is not supported.  Be sure to set the x-anchormailbox header if EWS Impersonation is used since it can make a massive difference in performance and is needed in some scenarios such as notifications in order to maintain affinity.
  • EWS can pull generated MIME from Exchange and can also create an item with MIME.  However, there is no ability to parse or otherwise work with what's in MIME.

Backgrounders:

This is a good article for an overview on Exchange development, including EWS:

Start using web services in Exchange
https://msdn.microsoft.com/en-us/library/office/jj900168(v=exchg.150).aspx

Here are some links on the EWS Managed AP to help you get started with the EWS Managed APII:

EWS Managed API, EWS, and web services in Exchange
https://msdn.microsoft.com/en-us/library/office/dd877012(v=exchg.150).aspx

Explore the EWS Managed API, EWS, and web services in Exchange
http://msdn.microsoft.com/en-us/library/office/jj536567(v=exchg.150).aspx

Get started with EWS Managed API client application
http://msdn.microsoft.com/en-us/library/office/dn567668(v=exchg.150).aspx

Getting Started with the EWS Managed API
https://github.com/OfficeDev/ews-managed-api/blob/master/README.md

Microsoft Exchange Web Services Managed API 2.2
http://www.microsoft.com/en-us/download/details.aspx?id=42951

Here is the source for the EWS Managed API:

EWS Managed API... open source?  YES!  It's now Open Source!!!
http://blogs.msdn.com/b/webdav_101/archive/2014/09/29/ews-managed-api-open-source-yes-it-s-now-open-source.aspx

There is also a JAVA API for EWS.  Please note that this API is not eligible for developer support.

EWS Java API - The story gets better... Open Source!!!
http://blogs.msdn.com/b/webdav_101/archive/2014/09/05/ews-java-api-the-story-gets-better-open-source.aspx

The EWS Managed API can be used under PowerShell.  This is truly a wonderful thing.  I'm saying this because when the power of EWS is combined with the power of PowerShell and Exchange cmdlets a developer or Admin can do almost anything with Exchange.

EWS with PowerShell Primer:

Learn to Use the Exchange Web Services with PowerShell
http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/02/learn-to-use-the-exchange-web-services-with-powershell.aspx

There is not a lot in the way of samples on using PowerShell, however the blog below covers the most common scenarios.

Glen's Exchange Dev Blog
http://gsexdev.blogspot.com/

Before the EWS Managed API was released the options for developing code for EWS were to either generate proxy classes with Visual Studio or to send raw POSTs of EWS XML.

Links on Common Exchange Web Services (EWS) Questions
http://blogs.msdn.com/b/webdav_101/archive/2008/10/02/links-on-common-exchange-web-services-ews-questions.aspx

Getting Started with EWS Proxy Programming in Exchange 2010
https://msdn.microsoft.com/en-us/library/office/bb408522(v=exchg.140).aspx

EWS Samples:

Working with the EWS Managed API 2.0
https://msdn.microsoft.com/en-us/library/office/dd633696(v=exchg.80).aspx

Exchange 2013 101 Code Samples
https://code.msdn.microsoft.com/office/Exchange-2013-101-Code-3c38582c

Exchange samples: learn through code
https://code.msdn.microsoft.com/exchange/

Below is a large sample which uses the EWS Managed API and raw EWS POSTs.  Its helpful as sample code, seeing how the EWS Managed API works, testing EWS operations and submitting EWS code. It contains many raw EWS samples also.  This sample/tool is highly used by those who write code for EWS and troubleshoot it.

EWSEditor
http://ewseditor.codeplex.com/

Glen's Exchange Dev Blog
http://gsexdev.blogspot.com

EWS operations in Exchange (Shows EWS XML bodies)
https://msdn.microsoft.com/en-us/library/office/bb409286(v=exchg.150).aspx

EWS: How to send signed email
http://blogs.msdn.com/b/emeamsgdev/archive/2015/08/10/ews-how-to-send-signed-email.aspx
Note that building MIME document content is not supported by Developer support unless a Microsoft API creates it and the same goes for parsing MIME content.

Open source apps with published source code:

EWSEditor
https://ewseditor.codeplex.com/

EWS: Streaming Notification Sample
http://blogs.msdn.com/b/emeamsgdev/archive/2013/04/16/ews-streaming-notification-sample.aspx

EWSRelentless
https://ewsrelentless.codeplex.com/

Further reading:

EWS Best Practices
http://blogs.msdn.com/b/webdav_101/archive/2015/05/03/ews-best-practices.aspx

EWS from a Web Application using Windows Authentication and Impersonation
http://blogs.msdn.com/b/emeamsgdev/archive/2012/11/05/exchange-web-services-from-a-web-application-using-windows-authentication.aspx

EWS: Performance issues when accessing multiple mailboxes?
http://blogs.msdn.com/b/emeamsgdev/archive/2014/02/27/ews-performance-issues-when-accessing-multiple-mailboxes.aspx

EWS: Missing SOAP headers when using the EWS Managed API
http://blogs.msdn.com/b/emeamsgdev/archive/2014/04/23/ews-missing-soap-headers-when-using-the-ews-managed-api.aspx

EWS: Performance issues when accessing multiple mailboxes?
http://blogs.msdn.com/b/emeamsgdev/archive/2014/02/27/ews-performance-issues-when-accessing-multiple-mailboxes.aspx
A low connection limit will effectively throttle your application on the client side due to .NET only opening a couple connections at most for outbound traffic.  This is a .NET per application setting.  Increasing this can prevent your application from choking and greatly increase performance.

Also see:

EWS Best Practices
http://blogs.msdn.com/b/webdav_101/archive/2015/05/03/ews-best-practices.aspx

About: Mailbox Accessing APIs
http://blogs.msdn.com/b/webdav_101/archive/2015/05/28/about-mailbox-accessing-apis.aspx

Exchange and Outlook Development Help
http://blogs.msdn.com/b/webdav_101/archive/2015/05/28/exchange-and-outlook-development-help.aspx

EWS discussion on stackoverflow
http://stackoverflow.com/questions/tagged/ews

Developer Support Messaging Team
http://blogs.msdn.com/tags/DevMsgTeam/

EMEA Developer Support for Messaging Team Blog
http://blogs.msdn.com/b/emeamsgdev/

Exchange Dev Blog
http://blogs.msdn.com/b/exchangedev/

Exchange Team Blog
http://blogs.technet.com/b/exchange/

Office Developer Documentation
https://msdn.microsoft.com/en-US/office/aa905340

Exchange Server development
https://msdn.microsoft.com/en-us/library/office/dn820100

Exchange development forums
https://social.msdn.microsoft.com/Forums/office/en-US/home?category=exchangeserver

Office client development
https://msdn.microsoft.com/en-us/library/office/dn833103.aspx

Get support - Exchange
https://support2.microsoft.com/oas/default.aspx?LN=en-us&gprid=730&x=13&y=7&st=1&wfxredirect=1&sd=gn

Support - All products
https://support.microsoft.com/en-us/allproducts

 

 

Comments (0)

Skip to main content