locked
EWS Request contains <t:RequestServerVersion Version="5" /> instead of <t:RequestServerVersion Version="Exchange2013_SP1" /> and responds with a:ErrorInvalidServerVersion RRS feed

  • Question

  • Hi,

    We have developed an VSTO Add-in which requires a EWS call to Exchange to convert an Outlook EntryId into EWS ID as a part of it's business logic. Our Add-in has been deployed to around 3000 internal users and we had no single problem so far (1 year in production) with this process. However we have one user that experiences a weird problem and cannot make a successfully EWS call. We are using Managed EWS API, so we do not manipulate EWS SOAP requests directly.

    Here is an overview of intercepted traffic in Fiddler:

    Working call resulting in 200 OK:

    POST https://.../ews/Exchange.asmx HTTP/1.1
    Content-Type: text/xml; charset=utf-8
    Accept: text/xml
    User-Agent: ExchangeServicesClient/15.00.0847.030
    Accept-Encoding: gzip,deflate
    Host: ....
    Content-Length: 781
    Expect: 100-continue
    Connection: Keep-Alive

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Header>
        <t:RequestServerVersion Version="Exchange2013_SP1" />
      </soap:Header>
      <soap:Body>
        <m:ConvertId DestinationFormat="EwsId">
          <m:SourceIds>
            <t:AlternateId Format="HexEntryId" Id="00000000811DBAA0580AD04DAAD6...F0000" Mailbox="P...@...com" />
          </m:SourceIds>
        </m:ConvertId>
      </soap:Body>
    </soap:Envelope>

    Call resulting in 500 Internal Server Error:

    POST https://.../ews/Exchange.asmx HTTP/1.1
    Content-Type: text/xml; charset=utf-8
    Accept: text/xml
    User-Agent: ExchangeServicesClient/15.00.0516.014
    Accept-Encoding: gzip,deflate
    X-ClientStatistics: MessageId=,ResponseTime=418,SoapAction=ConvertId;
    Host: ....
    Cookie: X-BackEndCookie=S-....; ClientId=...; exchangecookie=...
    Content-Length: 775
    Expect: 100-continue

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Header>
        <t:RequestServerVersion Version="5" />
      </soap:Header>
      <soap:Body>
        <m:ConvertId DestinationFormat="EwsId">
          <m:SourceIds>
            <t:AlternateId Format="HexEntryId" Id="0000000....F56B220000" Mailbox="B...@...com" />
          </m:SourceIds>
        </m:ConvertId>
      </soap:Body>
    </soap:Envelope>

    Microsoft Outlook version is the same in both cases. We explicitly set the version of the EWS client by:

    new ExchangeService(ExchangeVersion.Exchange2013_SP1)

    It seem however that when ExchangeVersion.Exchange2013_SP1 enum value would be casted to int, it would result in exactly 5.

    Is there any explanation why EWS Managed API could generate different (and wrong) EWS SOAP requests?

    Thursday, August 3, 2017 12:09 PM

All replies

  • I encountered the same behavior.  Also note the 5 appeared instead of Exchange2013_SP1 in the ExchangeService instance base class property, "RequestedServerVersion".  For me on one server there was an older version of Microsoft.Exchange.WebServices.dll in the GAC.  The Visual Studio Modules window showed me where it was (though I could have searched for it using gacutil).  I replaced the assembly in the GAC with the newer one I had in my app install folder (ver 15.0.913.15 not 15.0.516.14).  Then I restarted my app and the issue no longer occurred.
    Tuesday, October 3, 2017 9:26 PM
  • Note there is now a newer version here: https://github.com/officedev/ews-managed-api
    Monday, October 30, 2017 1:45 PM