472,338 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,338 software developers and data experts.

Drag & Drop Outlook.MailItem to a Windows.Forms.Form and save it

Hi,

if I drag an Outlook.MailItem to a Windows-Explorer window a
<subject>.msg file will be created.

Now I try to drag & drop a mail item to my own WinForm app.
Unfortunately it doesn't work. In the "drop event" are eight
DataFormats (e.Data.GetFormats()) but the important one (imho)
"FileContents" is "Nothing"/"null".

Any ideas?
Jul 21 '05 #1
1 7345
Hi Karsten,
I've been trying to get this to work my self, but so far haven't gotten any
further than to be able to drag and attachment in a mail to aWinForm.
The basic thinking behind a mail being dragged is a whole lot of COM and
interfaces. Here's the short version:

The objects (the mail(s)) being dropped is a COM class of IDataObject
interface.
It contains aFileGroupDescripter structure that contains an array of objects
(mails), so you can drag several mails at once.
Using the FORMATEDC and STGMEDIUM structures, it should be possible to get
the filename of the mail (eg. Message.msg), and a IStream interface to the
actual mail.
Once you have the IStream interface, it's easy to save it, but actually
getting there is much harder than what I had thought.

If you search MSDN, you'll find some samples on the various structures -
it's the same stuff MS uses for drag'n'drop and objects over the clipboard.
I have a C++ sample that does it all, as well as some VB.NET and C#.NET code
that allows you to drag an attachment from a mail. But not a .NET one that
saves the full mail.

Let me know if you want it - my email is (remove the spam)
sp****@spamlector.spamdk
Perhaps we can get this shit to work together?

/Thomas

"Karsten Schramm" <me*******@gmx.de> wrote in message
news:eb**************************@posting.google.c om...
Hi,

if I drag an Outlook.MailItem to a Windows-Explorer window a
<subject>.msg file will be created.

Now I try to drag & drop a mail item to my own WinForm app.
Unfortunately it doesn't work. In the "drop event" are eight
DataFormats (e.Data.GetFormats()) but the important one (imho)
"FileContents" is "Nothing"/"null".

Any ideas?

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jason Garland \(Secure Access Pty Ltd\) | last post by:
Any ideas on how to cure the following error ? The designer could not be shown for this file because none of the classes within it can be...
6
by: David Anderson | last post by:
Does anyone know how to drag&drop a message with attachments from Outlook (2002 or 2003) in to a VB.Net windows form. This is really stumping me. ...
0
by: Eugene | last post by:
Hi All, I uses System.Windows.Forms.Form.ActiveForm to get the form with the current control having the focus. However, I got a problem when my...
1
by: Karsten Schramm | last post by:
Hi, if I drag an Outlook.MailItem to a Windows-Explorer window a <subject>.msg file will be created. Now I try to drag & drop a mail item to...
3
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
1
by: Piotr | last post by:
This method not work. System.Windows.Forms.Form.Refresh() work good. Microsoft.Net Framework 1.1. _ This code not work. Should be work....
3
by: daveward10 | last post by:
I want to be able to drag and drop an Outlook mail message (Outlook 2003) onto a windows form (C# 2003) so that my application can then save the...
0
by: Pantokrator | last post by:
Hi! Could you please tell me what am I doing wrong here.... I've got a simple form called Form1 and all I want to do is to pass the pointer to...
6
by: jojoba | last post by:
Hi, I am trying to create a .net webservice such that: When a user calls the service, the server creates a System.Windows.Forms.Form and shows...
8
by: sheridan | last post by:
Hi. I'm hoping someone can shed some light on this bizarre problem that I have come accross. I have spent all evening trying to fix it with no...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.