473,474 Members | 1,304 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 7594
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 designed. The designer inspected the following classes...
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. I've spent a fair amount of time trying to find a...
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 application pops up another ShowDialog form. The...
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 my own WinForm app. Unfortunately it doesn't work....
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. Terrorism? .... Method2(Method()); .... public...
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 file (in the same was as if I were to drag and drop...
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 my other class called CCueMakerEngine. Here's what...
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 it on the server screen. I know this sounds...
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 luck! I have a frameless Windows.Forms form with...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.