none
CreateAttachment clears ContentId of other attachments RRS feed

  • Question

  • Hi everybody

    I'm experiencing a strange problem. I have an exchange 2010 server and I want to synchronize the attachments by EWS. Getting the attachments works just like it should. But when I create a new Attachment for a calendar item that already has some attachments, the content id of those will be cleared.

    For example the calendar item has two attachments:

    attachment1.png, content id = cid1

    attachment2.png, content id = cid2

    To create a new attachment, I send following XML to EWS:

    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP-ENV:Header>
          <ns2:RequestServerVersion xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/types"
                                    Version="Exchange2010"/>
          <TimeZoneContext xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
             <TimeZoneDefinition Id="W. Europe Standard Time"/>
          </TimeZoneContext>
       </SOAP-ENV:Header>
       <SOAP-ENV:Body>
          <ns2:CreateAttachment xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/messages"
                                xmlns:ns3="http://schemas.microsoft.com/exchange/services/2006/types">
             <ns2:ParentItemId ChangeKey="DwAAABYAAACbw/kj8+wZQb5RgDZk9KfaAAAm+u79"
                               Id="AAMkAGUyNjEyOTRlLTFhYTgtNDIxNi1iODFhLWY3MDVjYjQ5MWNlMQBGAAAAAABqq05HtsdNQJNWdqTzgU/hBwCbw/kj8+wZQb5RgDZk9KfaAAAADsEsAAACVaXmgqaBTb+mxGnNuyUJAAAA6ogIAAA="/>
             <ns2:Attachments>
                <ns3:FileAttachment>
                   <ns3:Name>attachment3.png</ns3:Name>
                   <ns3:ContentId>cid3</ns3:ContentId>
                   <ns3:Content>[some base64 encoded content]</ns3:Content>
                </ns3:FileAttachment>
             </ns2:Attachments>
          </ns2:CreateAttachment>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>


    The response of this request tells me that everything went fine and it gives me the attachment id for this attachment. But unfortunately the content id of all the other attachments have been cleared:

    attachment1.png, content id = ""

    attachment2.png, content id = ""

    attachment3.png, content id = cid3

    What am I doing wrong? Do I need to recreate every attachment when creating a new one? Or is it just a bug of exchange 2010?

    Thank you for your help!

    Friday, December 23, 2016 11:03 AM