GetAttachment 操作

GetAttachment 操作は、Exchange ストア内のアイテムの既存の添付ファイルを取得するために使用されます。

GetAttachment 要求の例

説明

次の GetAttachment 要求の例は、添付ファイルを取得する方法を示しています。

コード

<?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 要素を使用すると、返す添付ファイル情報を指定できます。 空の AttachmentShape 要素は有効であり、アイテムの添付ファイルの MIME コンテンツを含まない添付ファイル、テキスト本文の種類、および追加のプロパティなしで添付ファイルをレンダリングします。

AttachmentIds コレクションを使用すると、返す 1 つ以上の添付ファイル識別子を指定できます。 これらは RequestAttachmentIdType 型であるため、CreateAttachment から受け取る AttachmentId には、GetAttachment に渡す前に RootItemId 属性と RootItemChangeKey 属性が削除されている必要があります。

注:

添付ファイル識別子と変更キーは、読みやすさを維持するために短縮されました。

要求要素

要求では、次の要素が使用されます。

GetAttachment 応答の例

説明

次の例は、GetAttachment 要求に対する正常な応答を示しています。 次の使用例は、添付ファイルを返します。

コード

<?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 の応答メッセージには常に完全な添付ファイルが含まれます。つまり、すべてのプロパティは常に含まれます。 添付ファイルの場合、これらのプロパティは Name (AttachmentType)ContentTypeContentIdContentLocationContent です。 アイテムの添付ファイルの場合、これらのプロパティは、GetItem 呼び出しで AllProperties 図形が使用されていたかのように、名前 (AttachmentType)ContentTypeContentIdContentLocation、およびすべてのアイテムのプロパティです。 AttachmentShape 要素が存在する場合は、コンシューマー アプリケーションがアイテムの添付ファイルの追加の拡張プロパティを要求できるようになります。

成功した応答要素

応答では、次の要素が使用されます。

関連項目

CreateAttachment 操作

DeleteAttachment 操作