Поделиться через


CreateAttachment

Last modified: March 16, 2009

Applies to: Exchange Server 2007 | Exchange Server 2010

The CreateAttachment element defines a request to create an attachment to an item in the Exchange store.

<CreateAttachment>
   <ParentItemId/>
   <Attachments/>
</CreateAttachment>

CreateAttachmentType

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

None.

Child Elements

Element

Description

ParentItemId

Identifies the parent Exchange store item that contains the created attachment. The ParentItemId element must provide the ID of a real Exchange store item. Real store items can be retrieved by using the GetItem Operation; attachments are retrieved by using the GetAttachment Operation. An error occurs if the ParentItemId is passed the ID of a file attachment. If the ParentItemId represents the ID of an existing item attachment, the CreateAttachment Operation adds the new attachment to the existing attachment.

This element is required for the CreateAttachment Operation.

Attachments

Contains the items or files to attach to an item in the Exchange store.

Parent Elements

None.

Remarks

An item attachment does not exist as a store item. It only exists as an attachment to an item or another attachment. Item attachments can only be retrieved by using the GetAttachment request.

The following item attachments can be created:

  • Item

  • Message

  • CalendarItem

  • Contact

  • Task

  • MeetingMessage

  • MeetingRequest

The schema that describes this element is located in the EWS virtual directory of the computer that is running MicrosoftExchange Server 2007 that has the Client Access server role installed.

Example

The following example shows how to create and attach an item to another item in the Exchange store.

<?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="https://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Body>
    <CreateAttachment xmlns="https://schemas.microsoft.com/exchange/services/2006/messages" 
                  xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
      <ParentItemId Id="ASkAS"/>
      <Attachments>
        <t:ItemAttachment>
          <t:Name>MyAttachment</t:Name>
          <t:Message>
            <t:ItemClass>IPM>Note</t:ItemClass>
            <t:Subject>My attachment subject</t:Subject>
            <t:Body BodyType="Text">My attachment body</t:Body>
          </t:Message>
        </t:ItemAttachment>
      </Attachments>
    </CreateAttachment>
  </soap:Body>
</soap:Envelope>

Element Information

Namespace

https://schemas.microsoft.com/exchange/services/2006/messages

Schema Name

Messages schema

Validation File

Messages.xsd

Can be Empty

False