ews-cpp
0.9
|
A C++11 header-only library for Microsoft Exchange Web Services.
You can find a couple of small executable examples in the examples/ folder.
As an appetizer, this is how it looks when you create and send an email message with ews-cpp:
We host automatically generated API documentation here: otris.github.io/ews-cpp.
EWS is an API that third-party programmers can use to communicate with Microsoft Exchange Server. The API exists since Exchange Server 2007 and is continuously up-dated by Microsoft and present in the latest iteration of the product, Exchange Server 2016.
This library provides a native and platform-independent way to use EWS in your C++ application.
<CalendarItem>
, <Message>
, <Contact>
, <Task>
. Note that we still don't support all properties of all of these items. But we're working on it.<CreateItem>
, <SendItem>
, <FindItem>
, <GetItem>
, <UpdateItem>
, and <DeleteItem>
operations.<CreateFolder>
, <GetFolder>
, <DeleteFolder>
, <FindFolder>
operations on folders.<CreateAttachment>
, <GetAttachment>
, <DeleteAttachment>
for file attachments. Note: Item attachments are not supported yet.<Subscribe>
, <GetEvents>
, <Unsubscribe>
) to inform you about specific item or folder changes are supported.Note: Kerberos is currently not supported but its on the TODO list.
However, our goal is to support all Exchange Server versions since 2007.
The only thing you need for ews-cpp to run is libcurl.
If you want to hack on ews-cpp itself you additionally need
You can obtain an up-to-date and easy-to-use binary distribution of libcurl from here: confusedbycode.com/curl
Additionally, you probably need to tell CMake where to find it. Just set CMAKE_PREFIX_PATH
to the path where you installed libcurl (e.g. C:\Program Files\cURL
) and re-configure.
You can also use the Windows batch script provided in scripts\build-curl.bat
to download and compile libcurl for your particular version of Visual Studio.
ews-cpp's source code is available as a Git repository. To obtain it, type:
The library is header-only. So there is no need to build anything. Just copy the include/ews/
directory wherever you may like.
To build the accompanied tests with debugging symbols and Address Sanitizer enabled do something like this:
Type make edit_cache
to see all configuration options. make help
shows you all available targets.
To build the tests and examples on Windows you can use cmake-gui
. For more see: https://cmake.org/runningcmake/
If you do not want to use any GUI to compile the examples and tests you could do something like this with the Windows cmd.exe
command prompt:
Make sure to choose the right generator for your environment.
Use the doc
target to create the API documentation with Doxygen. Type:
In order to run individual examples or the test suite export following environment variables like this:
Be sure to change the values to an actual account on some Exchange server that you can use for testing. Do not run the tests on your own production account.
Once you've build the project, you can execute the tests with:
If you do not have any Exchange server available for testing you can run a subset of the tests that do not require a running server like this:
ews-cpp is written in a "modern C++" way:
Just add:
to your include directives and you are good to go.
Take a look at the examples/
directory to get an idea of how the API feels. ews-cpp is a thin wrapper around Microsoft's EWS API. You will need to refer to the EWS reference for Exchange for all available parameters to pass and all available attributes on items. From 10.000ft it looks like this:
You have items and you have the service. You use the service whenever you want to talk to the Exchange server.
Please note one important caveat though. ews-cpp's API is designed to be "blocking". This means whenever you call one of the service's member functions to talk to an Exchange server that call blocks until it receives a request from the server. And that may, well, just take forever (actually until a timeout is reached). You need to keep this in mind in order to not block your main or UI thread.
Implications of this design choice
Pros:
Cons:
ews-cpp is developed by otris software AG and was initially released to the public in July 2016. It is licensed under the Apache License, Version 2.0 (see LICENSE file).
For more information about otris software AG visit our website otris.de or our Open Source repositories at github.com/otris.