Is there a way to read an Outlook attachment directly to memory. I can only see a SaveAsFile() which wants a file path to save the attachment to. I have no need to save the attachment on disk first, just require the bytes from the attachment.
Is there a way to read an Outlook attachment directly to memory. I can only see a SaveAsFile() which wants a file path to save the attachment to. I have no need to save the attachment on disk first, just require the bytes from the attachment.
Saving Outlook attachment to memory
render77
AnilAli
What you are trying to do is a known technique. The Outlook OM does not allow you to do this. The VSTO 2005 tools for Outlook (I'm the PM for these tools) do not go beyond the Outlook OM per se (it's pretty powerful on its own).
To do this, I have traditionally used Extended MAPI. But, using Extended MAPI is not supported in .NET. You can still give it a try, but just know it is not supported. You can always drop to the metal in C++ and work with Extended MAPI and mix that into your code. I recommend reading up on these MAPI calls.
It is helpful to remember that this forum is mainly for issues that directly pertain to the Visual Studio Tools for Office tools per se. So you will be best served by posing this question to a forum or newsgroup wholly dedicated to application-specific issues such as yours. Here is a link to resources that will help you:
http://blogs.msdn.com/johnrdurant/archive/2005/12/07/vsto_outlook_resourcelist.aspx
John.
wckdtribal