473,883 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drag & Drop of Outlook message + attachments to VB.Net form

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 solution on the internet, with limited success.

I do have code to drag an attachment directly from Outlook to a form, but
not a whole message.
I want to have access to an object reprensenting the message so I can bust
out the message and attachments individually.

I have implemented a solution involving dragging the e-mail message from
Outlook to the desktop, then from the desktop to the windows form, but the
users don't want to do that and I don't think they should have to.

I've seen libraries and code that seem to make this easy using VB6, C++, or
COM, but almost nothing in .Net except simple examples of either files or
tree items, not Outlook e-mails directly onto VB.Net Winforms.

Any help appreciated.
Dave Anderson.
Nov 21 '05 #1
6 14692
David,

Mostly is implementing code in VBNet simple when you know the VBA code used
in outlook, did you ask this already in a VBA Outlook newsgroup?

Cor
Nov 21 '05 #2
David,
Unfortunately the format Outlook uses for Drag & Drop is not defined. You
can use the IDataObject.Get Formats to see the formats that Outlook is
offering to your app. However how to use the interesting formats that
probably contain the actual message is not defined.

Hope this helps
Jay

"David Anderson" <an******@one.n et> wrote in message
news:eb******** ******@tk2msftn gp13.phx.gbl...
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 solution on the internet, with limited success.

I do have code to drag an attachment directly from Outlook to a form, but
not a whole message.
I want to have access to an object reprensenting the message so I can bust
out the message and attachments individually.

I have implemented a solution involving dragging the e-mail message from
Outlook to the desktop, then from the desktop to the windows form, but the
users don't want to do that and I don't think they should have to.

I've seen libraries and code that seem to make this easy using VB6, C++,
or
COM, but almost nothing in .Net except simple examples of either files or
tree items, not Outlook e-mails directly onto VB.Net Winforms.

Any help appreciated.
Dave Anderson.

Nov 21 '05 #3
RD
I have probably tried the same things that you have with the same
results. I do have a potential workaround. You have been trying to
get to the MailItem by looking at the DragEventArgs. What you should
be able to do is use the DragEventArgs to determine if the dropped
item is an Outlook item. (I think that the objectdescripto r format
will have the text "Outlook".) If it is Outlook then use the Outlook
object model to get the message with code similar to:

Outlook._Applic ation myOlApp=new Outlook.Applica tionClass();
Outlook._Explor er myExp=myOlApp.A ctiveExplorer() ;
Outlook._MailIt em myMailItem=(Out look.MailItem)m yExp.Selection. Item(1);
string txtBody=myMailI tem.Body;

Now you have the MailItem and you can do whatever you like. Since
this is on the drop event the ActiveExplorer should be the outlook
instance that you dragged from. Likewise the item you are dragging
would still be the active selection. Sorry I gave you the snippet in
C#, but you get the point. Hope that helps.
Nov 21 '05 #4
RD,
Interesting kludge, it just might work.

If I find time I may look at this later.
Jay

"RD" <go****@pcsaddo ns.com> wrote in message
news:19******** *************** ***@posting.goo gle.com...
I have probably tried the same things that you have with the same
results. I do have a potential workaround. You have been trying to
get to the MailItem by looking at the DragEventArgs. What you should
be able to do is use the DragEventArgs to determine if the dropped
item is an Outlook item. (I think that the objectdescripto r format
will have the text "Outlook".) If it is Outlook then use the Outlook
object model to get the message with code similar to:

Outlook._Applic ation myOlApp=new Outlook.Applica tionClass();
Outlook._Explor er myExp=myOlApp.A ctiveExplorer() ;
Outlook._MailIt em myMailItem=(Out look.MailItem)m yExp.Selection. Item(1);
string txtBody=myMailI tem.Body;

Now you have the MailItem and you can do whatever you like. Since
this is on the drop event the ActiveExplorer should be the outlook
instance that you dragged from. Likewise the item you are dragging
would still be the active selection. Sorry I gave you the snippet in
C#, but you get the point. Hope that helps.

Nov 21 '05 #5
Go to the following site for an example:
http://codeproject.com/csharp/TestEmailDragDrop.asp

I have a treeview control that user drop either an email or an attachment
to, that I then save as an image.

Chuck

"David Anderson" wrote:
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 solution on the internet, with limited success.

I do have code to drag an attachment directly from Outlook to a form, but
not a whole message.
I want to have access to an object reprensenting the message so I can bust
out the message and attachments individually.

I have implemented a solution involving dragging the e-mail message from
Outlook to the desktop, then from the desktop to the windows form, but the
users don't want to do that and I don't think they should have to.

I've seen libraries and code that seem to make this easy using VB6, C++, or
COM, but almost nothing in .Net except simple examples of either files or
tree items, not Outlook e-mails directly onto VB.Net Winforms.

Any help appreciated.
Dave Anderson.

Nov 21 '05 #6
Go to the following site for an example of how to trap this:
http://codeproject.com/csharp/TestEmailDragDrop.asp

I have a treeview control that user drag an entire email, with attachments,
or just an attachment to, and I then save the contents as an image.

"David Anderson" wrote:
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 solution on the internet, with limited success.

I do have code to drag an attachment directly from Outlook to a form, but
not a whole message.
I want to have access to an object reprensenting the message so I can bust
out the message and attachments individually.

I have implemented a solution involving dragging the e-mail message from
Outlook to the desktop, then from the desktop to the windows form, but the
users don't want to do that and I don't think they should have to.

I've seen libraries and code that seem to make this easy using VB6, C++, or
COM, but almost nothing in .Net except simple examples of either files or
tree items, not Outlook e-mails directly onto VB.Net Winforms.

Any help appreciated.
Dave Anderson.

Nov 21 '05 #7

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

Similar topics

1
7652
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. In the "drop event" are eight DataFormats (e.Data.GetFormats()) but the important one (imho) "FileContents" is "Nothing"/"null".
0
3046
by: Richard | last post by:
Hi, I'm trying to do drag-n-drop from MS Outlook onto a C# form. I'm just proving a concept for management here so we don't need to get fancy; assume I'm dropping an Outlook e-mail message with 2 file attachements onto a form. I've read everything I could find in MSDN that is relevant and I've got the basic hooks in place: private void MainForm_DragEnter(object sender,
2
2813
by: Ivo Tcholakov | last post by:
Is it possible to drag and drop controls in an aspx page at runtime ? Meaning i have developed a ASP.NET web form, the web form is now downloaded in IE - now can i have this form to detect mouse events, and provide drag and drop functionality of the controls ? Thank You Ivo Tcholakov
4
2069
by: kemal asad | last post by:
how can i create a vb application where i can drag and drop ( with a move caracteristic) email from outlook, into my application( email viewer). thanks, any help is welcome, samples a great way of learning. Kemal
0
1024
by: DC | last post by:
I have a requirement for an application that, through drag and drop, takes the email attachments from Outlook 2000 desktop clients and sends them in binary format to a SQL Server database. At this point its a POC app, so I am being encouraged to keep it simple. I figure I could use a Webservice and SOAP for this, or perhaps a Windows Service (I have more experience writing winservices than webservices). I have a couple of questions I...
0
1759
by: YYZ | last post by:
Problem: I need to allow my users to drag an email out of Outlook and drop it on a winform -- from there, I need to get the text of that email (not just the sender and subject) -- from there I'll save it myself in a database. This is to allow them to track all the correspondance that happens between themselves and a customer. I've found code examples of how to do this with an ATTACHMENT out of Outlook, but not the email message itself...
4
14611
by: SStory | last post by:
I want to drag a message from Outlook to a richtextbox on a vb.net form. I don't get the message body. I have searched all over the place and found nothing. Does anyone know how to do this? I don't care about attachments. I just need the text. Thanks, Shane
0
1710
by: Ellen | last post by:
Hi! Please point me to the correct discussion if I am off base. We are beta testing a new Dot Net Framework application that allows us to upload documents of different file types for online storage with each of our transactions. We can easily drag and drop email attachments to the new application, but we cannot seem to drag and drop an email msg from Outlook. I suspect this may have something to do with security. We are able to export...
1
2937
by: jimbo986 | last post by:
Outlook Email drag and drop -------------------------------------------------------------------------------- Problem: I need to allow my users to drag an email out of Outlook and drop it on a winform -- from there, I need to get the text of that email (not just the sender and subject) -- from there I'll save it myself in a database. This is to allow them to track all the correspondance that happens between themselves and a customer. ...
0
9940
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11141
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10742
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10847
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7126
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4611
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 we have to send another system
2
4220
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3232
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.