Body of ItemAttachmentType RRS feed

  • Question

  • I'm writing an Exchange message client using EWS and I have a problem with getting the body of ItemAttachmentType attachments (MIME embedded messages). Instead of original source code of message body I'm always getting something else. It looks very similar but some HTML tags are in diifferent places and all inline images are stripped of... Sample code below: 


    GetAttachmentType atachmentForRequest = new GetAttachmentType();
    atachmentForRequest.AttachmentIds = new RequestAttachmentIdType[1];
    atachmentForRequest.AttachmentIds[0] = attachmentForID.AttachmentId;
    atachmentForRequest.AttachmentShape = new AttachmentResponseShapeType
    	BodyType = BodyTypeResponseType.Best,
    	BodyTypeSpecified = true,
    	IncludeMimeContent = true,
    	IncludeMimeContentSpecified = true
    GetAttachmentResponseType attachmentRequest = CRMGlobalObjects.Instance.ExchangeServiceBinding.GetAttachment(atachmentForRequest);
    AttachmentInfoResponseMessageType attachment = (AttachmentInfoResponseMessageType)attachmentRequest.ResponseMessages.Items[0];
    if (attachment.Attachments[0].GetType().Name == "ItemAttachmentType")
    	ItemAttachmentType itemAttachment = (ItemAttachmentType)attachment.Attachments[0];
    	if(itemAttachment.Item.GetType().Name == "MessageType")
    		string body = itemAttachment.Item.Body.Value;


    I can provide examples of original source of message attach as an Outlook Item and what I'm getting from EWS.

    Monday, August 29, 2011 2:38 PM