How to make Outlook use a specific DataObject for starting drag/drop of an attachment? (DragSource) RRS feed

  • Question

  • Hello!

    I am working on a Outook AddIn that handles special data files attached to e-mails.

    The idea is that these files can be dragged from the e-mail to any Windows application (e.g. Windows Explorer). But before the files can be dropped the attachments must be modified.

    For copy/paste I implemented a special DataObject class that does the job. As far as I know it should be possible to use this class for drag/drop too as Outlook must be calling DoDragDrop() at some point and the first parameter is an IDataObject.

    Unfortunately I cannot find any Outlook-API that allows to fill in my DataObject for its DoDragDrop call.

    I know there are many articles in the internet that do the data modification in the DropTarget. But I need to do it in Outlook because the DropTarget can be any Windows application.

    Any help or even other ideas on how to realize drag/drop are appreciated.



    Wednesday, November 2, 2016 2:48 PM


  • The best you can do is patch the DoDragDrop function dynamically from your COM addin and redirect it to your implementation that will call the original function when appropriate.

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    • Marked as answer by Hago67 Thursday, November 3, 2016 3:01 PM
    Wednesday, November 2, 2016 8:32 PM