Removing Attachments from different types of MailItems.Body

  • Thread starter Thread starter ww
  • Start date Start date
W

ww

Hello Everybody,

I am looking for some code sample to

- automatically remove attachments from different types of mail bodies
- store the attachments in a sample folder and
- add the filename (or a link to the stored file) to the mail text

I figured out that the storage and removal of attachments depend on
the type of the Body. If it is an explicit attachment, everything
works fine. If the attachment is embedded in the body, however, the
attachment is stored correctly but I do not see a way to remove the
attachment and replace it with the filename.

I appreciate any help, comments and suggestions!
Willfried
 
No, the attachments are stored and accessed in the same fashion regardless
of the body type, it is just that HTML body can have inline images. For that
to work correctly, the attachments must be stored as regular attachments,
they cannot be a link.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
If one would use either of these scripts for an Outlook 2002 rule,
does the script get copied into a file with an extension of .vb or
..vbs or does it matter?

Also, I want to save the attachement to a folder using a unc path
something like

\\test\dept\wc\file.ext

Where \how would I do this? As you can tell I know nothing about
scripting....vb or otherwise...Thanks for any help!
 
Outlook 2002 rules don't use scripts (despite the misleading name of the
rule condition). They use VBA macros with a MailItem or MeetingItem object
as the sole macro argument. UNC paths should work fine. If you're new to
Outlook VBA macros, these web pages should help you get started:

http://www.winnetmag.com/Articles/Index.cfm?ArticleID=21522&pg=1
http://www.slipstick.com/dev/vb.htm

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Sue,
Thanks for pointing me in the right direction...however I must
show exactly how ignorant I am...for the example
on:http://www.slovaktech.com/code_samples.htm#StripAttachments

Do I change the line:
strFolder = GetTempDir()
to:
strFolder = \\server\share

I understand the other part about pasting the finished script into
Project1|Microsoft Outlook Object|ThisOutlookSession ... right?

Have you written any books? I think I would like one or two and I
hope you actually get some royalties for it! Thanks!
 
GetTempDir() returns the path of the user's temporary directory. You could
indeed substitute a path string of your choosing.

See my signature for the book link.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top