FileStream as Outlook attachment

Add-in Express™ Support Service
That's what is more important than anything else

FileStream as Outlook attachment
 
IT Support




Posts: 12
Joined: 2016-08-19
Hi,

Going through the post on Outlook email attachments, I tried attaching an image from a url which worked.

The var fullFilePath had the path to the image.
attachments.Add(fullFilePath, OutlookApp.OlAttachmentType.olByValue);


Now, my requirement is to attach a file in the form of a FileStream to the outlook attachments method.
A way to go about it was to convert it to a temporary file on my C: drive or any other temporary location but I wanted to know is there a way to bypass it & directly attach the filestream to the attachments method without savign anywhere? Can you provide a code snippet for the same?


Thank you
Posted 13 Apr, 2017 08:48:24 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello,

The Outlook object model doesn't let you achieve this.

Check what Dmitry Streblechenko - the author of Outlook Spy and Outlook Redemption - said at https://social.msdn.microsoft.com/Forums/office/en-US/17efe46b-18fe-450f-9f6e-d8bb116161d8/attach-stream-data-with-outlook-mail-client?forum=outlookdev and https://social.msdn.microsoft.com/Forums/sqlserver/en-US/3aff3189-16df-4aee-9e2e-cd1a3d0520a9/for-eugene-add-attachment-from-stream-instead-of-from-file?forum=outlookdev.

Hope these help.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 13 Apr, 2017 09:02:16 Top