DeleteAttachment operation
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.
The following example of a DeleteAttachment request shows how to delete an item attachment.
<?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>
The attachment identifier has been shortened to preserve readability.
The following elements are used in the request:
The following example shows a successful response to a DeleteAttachment request.
<?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>
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
The RootItemId identifier and ChangeKey have been shortened to preserve readability.
The following elements are used in the response: