Search code examples
office365exchangewebservices

Getting an event's reference attachments with the EWS managed SOAP API


I want to retrieve a calendar event's OneDrive link attachments, but I can't use the C# APIs nor the Graph APIs so I am limited to the EWS SOAP APIs.

I sent my request as below:

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<soap:Header>
    <t:RequestServerVersion Version="Exchange2013_SP1"/>
    <t:ExchangeImpersonation>
        <t:ConnectingSID>
            <t:PrincipalName>MY_EMAIL</t:PrincipalName>
        </t:ConnectingSID>
    </t:ExchangeImpersonation>
</soap:Header>
<soap:Body>
    <m:GetItem>
        <m:ItemShape>
            <t:BaseShape>AllProperties</t:BaseShape>
            <t:AdditionalProperties>
                <t:FieldURI FieldURI="item:Attachments"/>
            </t:AdditionalProperties>
        </m:ItemShape>
        <m:ItemIds>
            <t:ItemId Id="THE_EVENT_ID"/>
        </m:ItemIds>
    </m:GetItem>
</soap:Body>

I expected the event's Attachments property to contain the link attachment, however the response XML didn't even contain a Attachments node, and I checked with the Graph API that the attachment's definitely there.

Is there a way to get information about reference link attachments or is this impossible without the C# or Graph APIs?


Solution

  • The problem was the server version. All I needed to do was to change it to 2016:

    <t:RequestServerVersion Version="Exchange2016" />