0
votes

This is a bit of a soft question, as I haven't really gotten to the point where I have started coding my project yet. What I'm looking for here are guidelines and recommendations as how best to build my desired software.

I've always been fascinated with drag and drop technology, and Outlook let's me drag an email to my desktop (in Windows) without a problem.

I wish to be able to continue to do this, but when dragged and dropped, I want the email on my desktop to be in .txt format, and be filled with the content of the email.

Now, the following is a little free thinking as to what I have going in my head thus far.

In order to drag an email out of Outlook it has to be selected, so I am thinking I can obtain the selected email through the following in C#.

Firstly using:

using Office = Microsoft.Office.Core; 
using Outlook = Microsoft.Office.Interop.Outlook;

Then getting the currently selected email by:

Outlook.Selection currentSelection = control.Context as Outlook.Selection;
Outlook.MailItem selectedMail = currentSelection[1];

Now, the way I see it, the content from the email needs to be obtained when the dragging begins, and result in a new .txt file when the drop happens, containing for example the message body text.

But that's just me thinking aloud.

How would some of you guys go about it?

Is there some way to specify an event occurrence when an element in Outlook is dragged?

And if so, can I specify what happens to the processed information when it drops? Like pasting it into a new .txt file at the desired location?

Or am I thinking about this all wrong?

1
Do you want it directly through Outlook ? or you want a interface as an application for drag and drop ?Rohit Prakash
@RohitPrakash Directly thought Outlook, if possible. Wouldn't I be able to control what happened to the dragged and dropped emails through Outlook alone?ViRALiC
Well, I am not really sure, if that is possible, but you may try with creating outlook addin to check it. otherwise, you have always an option to use an interface(Winform, WPF etc) to drag over any element and save the content in a text file.Rohit Prakash

1 Answers

0
votes

You can use the Selection object when you drag and drop Outlook items to any forms. So, if the item is dropped there you can get it via the Selection object in Outlook. But when you Drga&Drop Outlook items on the desktop (to any folder on the disk) you get a .msg file. There is no trivial way to override that behaviour.