Export (0) Print
Expand All
Expand Minimize

DeleteAttachment operation

Last modified: July 01, 2013

Applies to: Exchange Online | Exchange Server 2007 | Exchange Server 2010 | Exchange Server 2013 | Office 365

The DeleteAttachment operation is used to delete file and item attachments from an existing item in the Exchange store.

This operation allows you to delete one or more attachments by ID.

Description

The following example of a DeleteAttachment request shows how to delete an item attachment.

Code

<?xml version="1.0" encoding="utf-8"?>
<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">
  <soap:Body>
    <DeleteAttachment xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
                      xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <AttachmentIds>
        <t:AttachmentId Id="AAAtAEFkbWluaX"/>
      </AttachmentIds>
    </DeleteAttachment>
  </soap:Body>
</soap:Envelope>

Comments

The attachment identifier has been shortened to preserve readability.

Request Elements

The following elements are used in the request:

Description

The following example shows a successful response to a DeleteAttachment request.

Code

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="662" MinorBuildNumber="0" 
                         xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"/>
  </soap:Header>
  <soap:Body>
    <DeleteAttachmentResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" 
                              xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" 
                              xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
      <m:ResponseMessages>
        <m:DeleteAttachmentResponseMessage xsi:type="m:DeleteAttachmentResponseMessageType" ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:RootItemId RootItemId="AAAtAEFkbWluaXN..." RootItemChangeKey="CQAAABYAA..."/>
        </m:DeleteAttachmentResponseMessage>
      </m:ResponseMessages>
    </DeleteAttachmentResponse>
  </soap:Body>
</soap:Envelope>

Comments

The CreateAttachment operation returns an element of AttachmentIdType type that includes a RootItemId and RootItemChangeKey. These attributes are not permitted for identifiers within a DeleteAttachment request. DeleteAttachment uses elements of type RequestAttachmentIdType, which does not include these attributes.

The DeleteAttachment response includes the ID of the parent item. When attachments are removed from an item, the item's change key is modified. The new item change key can be obtained from the DeleteAttachment response.

Note Note

The RootItemId identifier and ChangeKey have been shortened to preserve readability.

Successful Response Elements

Show:
© 2014 Microsoft