How-to: Basic check for Exchange Web Services connectivity using code

When a program is about to start talking to Exchange there is the chance of some sort of connectivity problem which will cause its EWS calls to fail. A basic can EWS call can be done to see if EWS can be reached and process a basic request. Below is such a connectivity test call where a call to the EWS is done to convert the Id of an item from one form to another. This call should be processed and EWS respond with a 200 even though the conversion failed. What is important here is that EWS does process the request and reply with a 200 response – which means that the application can talk to EWS. If there was an issue such as one with authentication, then 401 would be returned.


Note that you can use any EWS call for checking connectivity. The example used here is what EwsEditor uses when you first log in.




<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="" xmlns:m="" xmlns:t="" xmlns:soap="">


<t:RequestServerVersion Version="Exchange2013" />



<m:ConvertId DestinationFormat="HexEntryId">


<t:AlternateId Format="HexEntryId" Id="00" Mailbox="" />








HTTP/1.1 200 OK

Transfer-Encoding: chunked

Content-Encoding: gzip

Vary: Accept-Encoding

request-id: b0493d2e-ac19-4199-8be3-b413149b9317

client-request-id: 945f0cef-60f6-4813-be00-7cb5eee92240

( The header is truncated )


<?xml version="1.0" encoding="utf-8"?>

<s:Envelope xmlns:s="">


<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="1157" MinorBuildNumber="22" Version="V2017_04_14" xmlns:h="" xmlns:xsd="" xmlns:xsi="" />



<m:ConvertIdResponse xmlns:m="" xmlns:xsd="" xmlns:xsi="" xmlns:t="">


<m:ConvertIdResponseMessage ResponseClass="Error">

<m:MessageText>Data is corrupt., Store ID isn't an ID of a folder, item or mailbox.</m:MessageText>









Comments (0)

Skip to main content