Using the Outlook object model, except in Outlook 2007, won't allow you to
do what you want. Even in Outlook 2007 if the data for the image is larger
than about 8KB you can't do what you want. You would need to use a lower
level API such as Extended MAPI (C++ or Delphi only), or a MAPI wrapper such
as Redemption (www.dimastr.com/redemption).
If you use a lower level API you can get the attachments collection, which
includes those embedded images. In that case you can get the attachment
property PR_ATTACH_MIME_TAG and read something like "image/jpeg" and the
property PR_ATTACH_EXTENSION and see something like ".jpg". You can use
those to identify the image type. The file name is changed and you can't do
anything about that. It will be something like PR_ATTACH_FILENAME =
"image001.jpg". Once the image is embedded it loses all connection to the
original image file.
Then you'd get the binary data for the image file using the PT_BINARY
property PR_ATTACH_DATA_BIN and read that array of bytes and save the byte
array out to the file system with the name you got from PR_ATTACH_FILENAME.
--
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
Post by khaiIm still stuck on this problem. It is definitely not possible to force users
to not use inline images as it would be an "un-friendly restriction" to
impose on the users.
I have found out that if Word is being used as the editor, the filename of
the attachment is automatically converted to something else i.e.
image001.jpg, as compared to the actual name of the file when Word is not
being used as the editor. Could this be the reason why the "Cannot save
attachment. Cannot add attachment; no data source was provided" error was
returned?