0

I created an Outlook Addin that allows you to drag and drop from Outlook to a web browser using the method outlined in wimix's answer here:

Drag & Drop directly from Outlook in web app

Basically I hook the Ole32 DoDragDrop function, save the data to file, convert the data to the CF_HDROP format and then call the DoDragDrop function again but pass the a new IDataObject.

Everything works as expected with IE and Edge. The only issue I'm having is that when dragging to certain pages in Chrome it does a "move" and deletes the original email. It seems to be related to the HTML5 DataTransfer.dropEffect and DataTransfer.effectAllowed properties. If they are not set or set to 'move' then that feedback is sent through to Outlook which deletes the original email.

It almost seems like that is how it should behave but I've tested this on other addins that allow drag and drop to browsers from Outlook and they don't seem to have the same issue. So I feel I should be able to fix/control this behavior in the addin but I'm not really sure how?

redwardo22
  • 13
  • 4
  • I tried the same as you. I was able to successfully hook into the DoDragDrop function. I am able to read all data from pDataObject. I am able to save the emails/attachments to a temp directory. BUT I was not able to extend the pDataObject with the CP_HDROP Format. Can you send me, or post here how you were able to get it working. What I tried so far. * Create a new System.Windows.Forms.DataObject and add the paths to the temp-files. With this I am able to Drag&Drop Emails to the browser. Problem with this solution. Drag&Drop inside Outlook does't work any more. – Markus1980Wien Jan 17 '18 at 16:19
  • second Idea I tried, Create a Windows-Forms-DataObject passing pDataObject to the constructor DataObject winFormsDataObject = new DataObject(pDataObject); winFormsDataObject.SetFileDropList(fdl); Does not throw an error - but CF_HDROP is not added. => no Drag&Drop to the Browser. – Markus1980Wien Jan 17 '18 at 16:23
  • third Idea I tried. Create FORMATETC, STGMEDIUM, and FILEDROP Structure and call pDataObject.SetData(ref formatetc, ref stgMedium, false) throws an DV_E_FORMATETC (Formatetc is invalid) – Markus1980Wien Jan 17 '18 at 16:27
  • I implemented my own version of an IDataObject using inheritance. There is a few examples around if you do some googling. Mostly in c++ though. The big problem I've come across is that after doing all this Outlook no longer recognizes the Drop and will let you drop the file back on the inbox and will duplicate the email. I haven't managed to solve this yet. I'm wondering if it has something to do with some of the other drop formats that go with and Outlook Drag and Drop like RenPrivateSourceFolder? Not sure. – redwardo22 Jan 18 '18 at 01:49

0 Answers0