My VSTO plugin intercepts attachments, however there’s a case that when I attempt to intercept attachments (on-send) from the explorer I receive the error at the very end. The logic is entirely the same for Explorer and Inspector attachment handling, it looks as:
currentMail.Attachments[i].SaveAsFile(tempfile);
The error is:
Cannot save the attachment. Cannot add the attachment; no data source was provided.
Now I suspect this is related to the email being in use (by Outlook), as I am able to trigger the same code if I modify it as a draft first, save it and then send the email.
What does error code -2147467259
represent though?
More of the error:
Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
ErrorCode -2147467259 int
HResult -2147467259 int
HelpLink null string
InnerException null System.Exception
Message "Cannot save the attachment. Cannot add the attachment; no data source was provided." string
Source "Microsoft Outlook" string
StackTrace " at Microsoft.Office.Interop.Outlook.Attachment.SaveAsFile(String Path)rn
TargetSite {Void SaveAsFile(System.String)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}