How to determine original filename from an attached .msg-file?

T

Tony

Hi,

I need to determine filenames from attachements in a new mail.

I create a new mail (new mail inspector is opening) and attache several
files from desktop via drag&drop.

All files will be displayed in the new inspector with their original
filenames as title. In this case I'm able to determine original filename
from attachments properties (PR_ATTACH_FILENAME and/or
PR_ATTACH_LONG_FILENAME).
But when I attach another msg-file (saved from outlook), msg-files
subject will be displayed in the inspector (as attachments title). In
this case I get MAPI_E_NOT_FOUND for
PR_ATTACH_FILENAME/PR_ATTACH_LONG_FILENAME. Only
PR_DISPLAY_NAME-Property is available but contains subject instead of
filename.
Any ideas, how it is possible to determine native original filename of
attached msg-file?

Thanks!
 
D

Dmitry Streblechenko

File name does not make sense for the embedded messages. For all practical
purposes the embedded messages are never even represented as files unless
you drag message to Windows Explorer or click File|Save As|MSG in Outlook.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
T

Tony

In this case, I previously saved an outlook message under the filename
xyz.msg to Windows Desktop, using click File|Save As|MSG in Outlook.

Then I create a new mail and attach this saved file 'xyz.msg' via
drag&drop to outlooks new inspector-window. This attachment will be
displayed with subject 'Happy new Year' as title instead of the
filename. But in my Add-In I ever need the original filename of all
attachment also of MSG-files. But the information about the original
filename 'xyz.msg' seems to be away.

In other mail-clients like Outlook Express or Thunderbird previous saved
messages (as file), will be displayed (as expected) with their
original filename too. For example, when I save an email from Outlook
Express under 'xyz.eml' to Windows Desktop and attach this message-file
to new created email in Outlook Express, then the original filename
will be displayed 'xyz.eml' instead of the subject like in Outlook.
 
D

Dmitry Streblechenko

In case of MSG attachments Outlook tries to be "smart" and realizes that MSG
file really means an embedded message. The result is the same as if you were
to drag the mesage from an Outlook folder bypassing the file system
completely.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

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