none
EmailMessage with another EmailMessage as an attachment RRS feed

  • Question

  • Hi

     

    I’m desperately trying to create an EmailMessage with another existing EmailMessage as an attachment. If I use the AddItemAttachment<EmailMessage> the attached message is at new mail, and when shown in Outlook, the mail is ready to send, and not read-only as normal in Outlook.

     

    So my question is – who do I create an email with and old email as an attachment, show normally in Outlook?

     

    With regards

    Jens Christiansen

    Thursday, February 7, 2013 8:38 PM

All replies

  • You need to set MessageFlags property http://msdn.microsoft.com/en-us/library/office/cc839733.aspx on the Attached Item to Sent eg

                EmailMessage em = new EmailMessage(service);
                em.Subject = "Parent";
                em.ToRecipients.Add("user@.domaincom");
                ItemAttachment at = em.Attachments.AddItemAttachment<EmailMessage>();
                
                at.Name = "Attached Message Item";
                at.Item.Subject = "test";
                ExtendedPropertyDefinition PR_Flags = new ExtendedPropertyDefinition(3591, MapiPropertyType.Integer);
                at.Item.SetExtendedProperty(PR_Flags, "1");
                ((EmailMessage)at.Item).Sender = new Microsoft.Exchange.WebServices.Data.EmailAddress("fred@blah.com");
                ((EmailMessage)at.Item).ToRecipients.Add("user@blahblah.com");
                em.Send();
    Cheers
    Glen
    Friday, February 8, 2013 2:33 AM
  • Fantastic that worked, thanks for your reply.

    Friday, February 8, 2013 6:29 AM