ערוך

שתף באמצעות


CreateAttachment

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="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Body>
    <CreateAttachment xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" 
                  xmlns:t="http://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

Element Example
Namespace
http://schemas.microsoft.com/exchange/services/2006/messages
Schema Name
Messages schema
Validation File
Messages.xsd
Can be Empty
False

See also

CreateAttachment operation

DeleteAttachment operation

GetAttachment operation