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. 6 14617
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
David,
Unfortunately the format Outlook uses for Drag & Drop is not defined. You
can use the IDataObject.GetFormats 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.net> wrote in message
news:eb**************@tk2msftngp13.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.
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 objectdescriptor 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._Application myOlApp=new Outlook.ApplicationClass();
Outlook._Explorer myExp=myOlApp.ActiveExplorer();
Outlook._MailItem myMailItem=(Outlook.MailItem)myExp.Selection.Item( 1);
string txtBody=myMailItem.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.
RD,
Interesting kludge, it just might work.
If I find time I may look at this later.
Jay
"RD" <go****@pcsaddons.com> wrote in message
news:19**************************@posting.google.c om... 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 objectdescriptor 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._Application myOlApp=new Outlook.ApplicationClass(); Outlook._Explorer myExp=myOlApp.ActiveExplorer(); Outlook._MailItem myMailItem=(Outlook.MailItem)myExp.Selection.Item( 1); string txtBody=myMailItem.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.
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.
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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....
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |