Copy Attachments from one mailitem to another

V

vincent.y.chan

Hi,

I wonder if anyone knows how to copy attachments from one mailitem to
another? I have tried using redemption to do this but I have been
unsuccessfully so far. Here's what my code looks like

If Not attachments Is Nothing Then
For Each attachment As Attachment In
attachments
If attachment.Size <> 0 Then
safeMailItem.Attachments.Add(attachment)
'End If
Next
End If

I don't know why but attachment.size is always 0, even though I know
there is an attachment in Attachments. I wonder does anyone know why
this happens? For some reason, i'm able to retrieve the
attachment.filename value but when I try to read the attachment.size
value, it is always set to zero.

Any help would be much appreciated,

thanks,
Vincent
 
K

Ken Slovak - [MVP - Outlook]

You must save the attachments to the file system and then load them from
there using Attachments.Add.
 
V

vincent.y.chan

You must save the attachments to the file system and then load them from
there using Attachments.Add.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm


I wonder if anyone knows how to copy attachments from one mailitem to
another? I have tried using redemption to do this but I have been
unsuccessfully so far. Here's what my code looks like
If Not attachments Is Nothing Then
For Each attachment As Attachment In
attachments
If attachment.Size <> 0 Then
safeMailItem.Attachments.Add(attachment)
'End If
Next
End If
I don't know why but attachment.size is always 0, even though I know
there is an attachment in Attachments. I wonder does anyone know why
this happens? For some reason, i'm able to retrieve the
attachment.filename value but when I try to read the attachment.size
value, it is always set to zero.
Any help would be much appreciated,
thanks,
Vincent

Thank you so much Ken, it works now.

Can I ask why I would need to do that?

thanks again.

Vince
 
V

vincent.y.chan

That's just the way Outlook attachments are.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm


Thank you so much Ken, it works now.
Can I ask why I would need to do that?
thanks again.

Hi Ken,

I tried testing this solution outlook 2003 as well and it doesn't seem
to work. Is there a different approach I should use for outlook 2003
than outlook 2007? or should the same approach work?
 
K

Ken Slovak - [MVP - Outlook]

There should be no changes in attachment handling in any Outlook version as
far as saving them to the file system and then attaching the saved files to
another item.




<snip>

Hi Ken,

I tried testing this solution outlook 2003 as well and it doesn't seem
to work. Is there a different approach I should use for outlook 2003
than outlook 2007? or should the same approach work?
 

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