Drag and drop of emails from outlook to my C# application

  • Thread starter Thread starter Johann Wagner
  • Start date Start date
J

Johann Wagner

Hello!

I want to drop an email in my C# application. I get the drop event and the
dataobject. But i cannot interpret the data in the dataobject. So i cannot
get the email. I have found a code sample for getting appendix via
drag&drop, but this doesn't work for the email, too. Can somebody give me a
tip how i can get the email?

Regards,
Johann
 
Unless you are using Extended MAPI, there is no way to do that - besides a
couple of internal formats, drag data contains messages in the MSG format.
Or, since a user must select the messages in Outlook first to drag them,
simply query Application.ActiveExplorer.Selection collection.

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

thank you for your help! I can get the actual selection as you described.

But you wrote that the drag data contains messages in MSG format. Can i get
the messages and save them to .msg files?
The FileContents Data is null so i think it must be the RenPrivateMessages.
Is that right? Can i separate the msg files from there?
Do you know how i can do that?

Johann
 
You need to use the CF_HDROP format and DragQueryFile() to access the
temporary file names.

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

i use CSharp, so i cannot use DragQueryFile(). The format CF_HDROP is not
available, too.

The formats available are:

RenPrivateSourceFolder
RenPrivateMessages
FileGroupDescriptor
FileContents
Object Descriptor
System.String
UnicodeText
Text

The first 3 are MemoryStreams which i cannot interpret.
The FileContents is always null.
Object Descriptor is MemoryStream which i cannot interpret, too
Others are strings with the mail subject.

Do you know how i can access it in CSharp?

Johann
 
Thanks for the tool, but i didn't get the dragdrop data from clipboard.
Maybe it depends on that i am using CSharp and the .NET Framework.
 
Back
Top