Search code examples
outlookoutlook-addinemail-attachmentsoutlook-2010

Outlook Add-in Error when sending attachments "System.IO.DirectoryNotFoundException"


I have a MS Outlook 2010 plugin that forwards emails to a pre-set email address on click.

However, when the forwarded email message contains an existing attachment, the below appears when the button is clicked

.

I have checked on another machine with a new Outlook and plugin installation and the same problem persists. Running on 32 bit Windows Vista, other machine on 32bit XP.

I have attempted to change trust settings to automatically download attachments, but no luck with that. Turned off attachment preview, enabled automatic downloads, and enabled all macros inc. to installed add-ins.


Solution

  • In your "Forwarder.Ribbon2.ForwardTo" method, ensure that the path you're using as the argument for the attachment "SaveAsFile" method is in a directory that already exists.

    The trust settings have almost certainly got nothing to do with this issue.

    Good luck,

    p.s. For your next question, it's usually good form to post code, rather than link to a screenshot of a stack trace...