GetAttachment Operation
The document is archived and information here might be outdated

GetAttachment Operation

Topic Last Modified: 2008-09-05

The GetAttachment operation is used to retrieve existing attachments on items in the Exchange store.

The following example of GetAttachment request shows how to get an attachment.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=""
    <GetAttachment xmlns=""
        <t:AttachmentId Id="AAAtAEFkbWluaX..."/>

The AttachmentShape element allows you to specify which attachment information should be returned. An empty AttachmentShape element is valid and will render your attachments without MIME content for item attachments, with a text body type, and without any additional properties.

The AttachmentIds collection allows you to specify one or more attachment identifiers to return. Note that these are of type RequestAttachmentIdType, so any AttachmentIds that you receive from CreateAttachment must have the RootItemId and RootItemChangeKey attributes removed before passing them to GetAttachment.

The attachment identifier and change key have been shortened to preserve readability.

The following example shows a successful response to a GetAttachment request. This example returns a file attachment.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="" 
    <t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="662" MinorBuildNumber="0" 
    <GetAttachmentResponse xmlns:m="" 
        <m:GetAttachmentResponseMessage ResponseClass="Success">
              <t:AttachmentId Id="AAAtAEFkbWluaX..."/>

The response messages for GetAttachment will always contain the full attachment; that is, all properties will always be included. For file attachments, those properties are Name (AttachmentType), ContentType, ContentId, ContentLocation, and Content. For item attachments, those properties are Name (AttachmentType), ContentType, ContentId, ContentLocation and all of the item’s properties, as if the AllProperties shape had been used in a GetItem call. The AttachmentShape element, if present, will allow a consumer application to request additional extended properties for item attachments.

© 2016 Microsoft