Exchange Web Service - CreateAttachment to Attach an Existing Item in a Folder RRS feed

  • Question

  • Hi,

    I would like to know if someone could help me understand how to create an EWS attachment for a message where the attachment is an existing email message that resides in a folder in the user's mailbox on the Exchange server. I've seen lots of examples that seem to work if the attachment message is specified as a 'New' message in the CreateAttachment request (i.e.:, but I have not found an example that I can reference if I want to attach an existing message in a folder.  Think of it like a forward - except I want to create new message and attach the message that I'm forwarding.

    Here's what I am trying to do:

    1. Retrieved the Id and ChangeKey for a message that I want to attach

    2. Create a new draft message

    3. Create a new attachment referencing the Id and ChangeKey from step 1

    4. Send the draft message

    I am currently stuck at step 3 with the following error:

                <m:CreateAttachmentResponseMessage ResponseClass="Error">
                   <m:MessageText>Set action is invalid for property.</m:MessageText>
                      <t:FieldURI FieldURI="item:ItemId"/>

    A sample of the CreateAttachment Xml I am using in the request is as follows (long attributes truncated for readability):

    <CreateAttachment xmlns='' xmlns:t=''>
       <ParentItemId Id="AAAk ... B7bBBwAAA=" ChangeKey="CQ ... B7bgGp"/>
             <t:Name>My Email Attachment</t:Name>
                <t:ItemId Id="AAAkAFR ... yQDAAA=" ChangeKey="CQAA ... ANicg=="/>
                <t:ParentFolderId Id="AAAkAF ... VAAA=" ChangeKey="AQAAAA=="/>

    I think that all of the above steps are correct as I have successfully completed step 3 if I do a file attachment.  However, I really want to attach an existing email (one that was sent to me ... not one that I create).

    I tried posting this on the Exchange Server 2010 forum, but they suggested that this would be a better forum to determine exactly how to accomplish this task.

    I would very much appreciate any assistance that can be provided.

    Thanks, Tyler

    Thursday, March 14, 2013 10:13 PM