unable to save attachment-- Outlook 2003, C#

K

Krishna

Hi,
I am developing a plug-in to Outlook 2003 using C#.

I am trying to save attachments in the mail-item-send event handler.
If the mail-item has ordinary attachments, like when user clicks Attach
button, I am able to save them. But, if the mail-item has attachment as
a result of an inline image(user copy-paste an image to mail body) I
get a COM exeption, with the message:

"Cannot save the attachment. Cannot add the attachment; no data source
was provided."

my code to save attachment is something like this:

Ol.Attachment Attachment = mi.Attachment;
String myDir = "C:\\EmailAttachments";
String myfullName = myDir + "\\" + Attachment.FileName;

try
{
Attachment.SaveAsFile(myfullName);
}
catch(Exception ex)
{
.....
}

Can someone help me with this problem. If its not possible for me to
save the Attachment in the send-mail event handler, is there any
work-around.

Thanks,
Krishna.
 
K

Krishna

Currently I am using ItemSend event handler.

Try using the ItemSend Event.

Hi,
I am developing a plug-in to Outlook 2003 using C#.
I am trying to save attachments in the mail-item-send event handler.
If the mail-item has ordinary attachments, like when user clicks Attach
button, I am able to save them. But, if the mail-item has attachment as
a result of an inline image(user copy-paste an image to mail body) I
get a COM exeption, with the message:
"Cannot save the attachment. Cannot add the attachment; no data source
was provided."
my code to save attachment is something like this:
Ol.Attachment Attachment = mi.Attachment;
String myDir = "C:\\EmailAttachments";
String myfullName = myDir + "\\" + Attachment.FileName;

try
{
Attachment.SaveAsFile(myfullName);}catch(Exception ex)
{
....
}Can someone help me with this problem. If its not possible for me to
save the Attachment in the send-mail event handler, is there any
work-around.
Thanks,
Krishna.- Hide quoted text -- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top