none
Issue "Outlook has encountered a problem.You will not be able to undo this action" while adding an attachment form code behind on RTF mail body RRS feed

  • Question

  • Hi,

    I am trying to add RTF attachment from code behind, and Outlook randomly prompts me with below screen:

    "Outlook has encountered a problem. You will not be able to undo this action once it is completed. Do you want to continue ?"

    

    And after multiple attempts on consecutive mails, which are in rich text format it leads to Outlook crash. 

    Here is code i use to set an attachment:

    mailItem.Attachments.Add(item.FilePath, MicrosoftInterop.OlAttachmentType.olByValue, 1, item.DisplayName);

    • Edited by Rakeshr45 Monday, May 11, 2015 11:26 AM
    Monday, May 11, 2015 11:24 AM

Answers

All replies

  • Ah ! It's my mistake, i need to re-set the mail format back from RTF to HTML before adding any attachments.


    Monday, May 11, 2015 11:50 AM
  • Hello Rakesh,

    It doesn't matter what body format is used for the mail item. Could you be more specific?

    What is the actual parameter passed to the Add method of the Attachments class? What Outlook version do you use? Do you run the code from a secondary thread? 

    Note, the source of the attachment can be a file (represented by the full file system path with a file name) or an Outlook item that constitutes the attachment.


    Monday, May 11, 2015 12:42 PM