Exchange Web Service listing items of a folder

I am getting this error message from MS Exchange:

The EWS Id is in EwsLegacyId format which is not supported by the Exchange version specified by your request. Please use the ConvertId method to convert the Id from EwsId to EwsLegacyId format.

in response to the following soap request:

<?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>

</soap:Header>
<soap:Body>
    <m:FindItem Traversal="Shallow">
        <m:ItemShape>
            <t:BaseShape>Default</t:BaseShape>
           <!-- 
            <t:AdditionalProperties>
                <t:FieldURI FieldURI="item:TextBody" />
                <t:FieldURI FieldURI="item:Body" />

            </t:AdditionalProperties>
            -->
        </m:ItemShape>
        <m:IndexedPageItemView MaxEntriesReturned="100" Offset="0" BasePoint="Beginning" />
        <m:ParentFolderIds>
            <t:FolderId Id="AQMkAGEzZTIzOWNmLWFiMGUtNDg5NC05NzNlLTUxN2FmNGQ3ZjIxMQAALgAAA95uXloT2IJPlNaCGuwj8ycBAObfRJ+1FF9PkWpl8+aNmhoAAAIBDAAAAA==" ChangeKey="AQAAABYAAADm30SftRRfT5FqZfPmjZoaAAAPjzNZ" />
        </m:ParentFolderIds>
    </m:FindItem>
</soap:Body>

I got the folder id from a previous FindFolder operation which list the folder hierarchy.

How to solve this problem?

Upvotes: 3

Views: 2658

Answers (2)

RaviStrs
RaviStrs

Reputation: 614

I too had same problem.

Added the RequestServerVersion in the Header. That solved the problem.

    '  <soap:Header>' +
    '    <RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" soap:mustUnderstand="0" />' +
    '  </soap:Header>' +

Upvotes: 4

Mimi Gentz
Mimi Gentz

Reputation: 1658

You need to add

<t:RequestServerVersion Version="Exchange2007_SP1" /> 

between your tags. Version can be any of those defined here: EWS schema versions in Exchange.

However, once you get that past that error you'll get another one for trying to request the item:TextBody and item:Body. To get the body of a message, you'll need to send a GetItem operation that includes the ItemId of the item to bind to (ie. get).

See this page for more info: How to: Work with Exchange mailbox items by using EWS.

Upvotes: 0

Related Questions