Background:
I am in the process of designing an application that will allow items to be dragged to it and will invoke some long running processes on them. The items will normally be dragged in from the filesystem and from Outlook. My concern is with the latter.
How can I hook into Outlook to find out if a message (or several) has been dragged out of it and on to my application and what the message ID is/are?
I understand that the Outlook object model does not have such drag/drop events and one solution is to listen to the Windows messages – this is not feasible in the team, as our combined Interop knowledge is not great.
We will be using C# 4.0 in Visual Studio 2010 for developing this application.
You cannot get access to the
MailItem.EntryIDdirectly from Outlook via the genericIDataObjectdrag-n-drop interface. If you just want to access the MSG data, then you can use this CodeProject example. Once an MSG is copied to disk (or clipboard, drag-n-dropped, etc.), it loses any reference to anEntryID.The only way I know of to get access to the
EntryIDis by using VSTO and using theActiveExplorer().Selectionto see which items are selected at the time of the drop action. Here is an example of accessing the Body of a selected message during a drag-n-drop command. You should be able to find numerous examples once you see the general pattern being used.