473,499 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
+ 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 7595
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
2284
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
14627
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
2493
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
838
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
10560
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
1
1778
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
4037
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
1325
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
2007
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
4339
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
7130
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7220
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...
0
5468
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,...
1
4918
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4599
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
3098
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3090
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
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
664
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.