GetAttachment 操作GetAttachment operation

GetAttachment 操作用于检索 Exchange 存储中项目的现有附件。The GetAttachment operation is used to retrieve existing attachments on items in the Exchange store.

GetAttachment 请求示例GetAttachment request example

DescriptionDescription

下面的 GetAttachment 请求示例演示如何获取附件。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="https://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Body>
    <GetAttachment xmlns="https://schemas.microsoft.com/exchange/services/2006/messages"
    xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
      <AttachmentShape/>
      <AttachmentIds>
        <t:AttachmentId Id="AAAtAEFkbWluaX..."/>
      </AttachmentIds>
    </GetAttachment>
  </soap:Body>
</soap:Envelope>

备注Comments

AttachmentShape元素允许您指定应返回的附件信息。The AttachmentShape element allows you to specify which attachment information should be returned. 空的AttachmentShape元素有效,并将呈现不包含任何其他属性的项目附件的 MIME 内容的附件。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. 请注意,这些类型的类型为 RequestAttachmentIdType,因此从CreateAttachment收到的任何会话在将其传递到RootItemChangeKey之前,必须删除RootItemIdGetAttachment属性。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.

Request 元素Request elements

请求中使用以下元素:The following elements are used in the request:

GetAttachment 响应示例GetAttachment response example

DescriptionDescription

下面的示例演示对 GetAttachment 请求的成功响应。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="https://schemas.microsoft.com/exchange/services/2006/types"/>
  </soap:Header>
  <soap:Body>
    <GetAttachmentResponse xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages" 
                           xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
                           xmlns="https://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

GetAttachment 的响应邮件始终包含完整的附件;也就是说,将始终包含所有属性。The response messages for GetAttachment will always contain the full attachment; that is, all properties will always be included. 对于文件附件,这些属性是名称(AttachmentType)ContentTypeContentIdContentLocationContentFor file attachments, those properties are Name (AttachmentType), ContentType, ContentId, ContentLocation, and Content. 对于项目附件,这些属性是名称(AttachmentType)ContentTypeContentIdContentLocation和项目的所有属性,就像AllProperties形状已在 GetItem 调用中使用一样。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. AttachmentShape元素(如果存在)将允许使用者应用程序请求项目附件的其他扩展属性。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

CreateAttachment 操作CreateAttachment operation

DeleteAttachment 操作DeleteAttachment operation