I have an outlook add-in that handles email attachments. I have my own ribbon button to add attachments but I would like to catch attachments added via drag and drop while ignoring attachments added using the standard attachment button.
It is easy enough to implement a ItemEvents_10_BeforeAttachmentAddEventHandler() but I know of no way to distinguish between attachments added with drag and drop and via the attachment menu button.
Is this possible?
Is it possible to handle the drag and drop event directly my self?
OOM won't help you here. In theory, you can overwrite the Outlook drag/drop handler.
IOleWindow
interface (you can cast Inspector
object to IOleWindow
).GetProp(hwnd, "OleDropTargetInterface")
Windows API - cast the returned value to IDropTarget
interface. You probably need to experiment with which child window of the inspector is the drag/drop target you want.RevokeDragDrop
/ RegisterDragDrop
passing your own implementation of IDropTarget
. That implementation can then (after doing what you need to do) call the original IDropTarget
interface to let Outlook proceed with the default behavior.