GetAttachment operation
The GetAttachment operation is used to retrieve existing attachments on items in the Exchange store.
GetAttachment request example
Description
The following example of GetAttachment request shows how to get an 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>
<GetAttachment xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<AttachmentShape/>
<AttachmentIds>
<t:AttachmentId Id="AAAtAEFkbWluaX..."/>
</AttachmentIds>
</GetAttachment>
</soap:Body>
</soap:Envelope>
Comments
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.
Note
The attachment identifier and change key have been shortened to preserve readability.
Request elements
The following elements are used in the request:
GetAttachment response example
Description
The following example shows a successful response to a GetAttachment request. This example returns a file attachment.
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>
<GetAttachmentResponse 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:GetAttachmentResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Attachments>
<t:FileAttachment>
<t:AttachmentId Id="AAAtAEFkbWluaX..."/>
<t:Name>SomeFile</t:Name>
<t:Content>AQIDBAU=</t:Content>
</t:FileAttachment>
</m:Attachments>
</m:GetAttachmentResponseMessage>
</m:ResponseMessages>
</GetAttachmentResponse>
</soap:Body>
</soap:Envelope>
Comments
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.
Successful response elements
The following elements are used in the response:
See also
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應