Drag and Drop support for E-Mails from Microsoft Outlook
Categories
(Core :: DOM: Copy & Paste and Drag & Drop, enhancement, P3)
Tracking
()
People
(Reporter: michael.schoendorfer, Assigned: marco.spiess)
References
Details
(Keywords: parity-chrome, parity-edge, Whiteboard: [platform-rel-Microsoft][platform-rel-Outlook])
Attachments
(2 files, 2 obsolete files)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 Firefox is not able to handle Drag and Drop of objects with the CFSTR_FILEDESCRIPTOR or CFSTR_FILECONTENTS format, so I cannot import E-Mails from Microsoft Outlook to a web application as I can do with Files from Windows Explorer. Reproducible: Always Steps to Reproduce: 1. Create an HTML document that handles the ondrop event and outputs all dropped files of event.datatransfer. 2. Open this document in Firefox. 3. Open Microsoft Outlook 2007. 4. Drag an E-Mail from Outlook to the HTML document in Firefox. Actual Results: The ondrop event is triggered but event.datatransfer.files has no elements. Expected Results: The ondrop event is triggered and event.datatransfer.files has as many elements as E-Mails were dropped. The filenames of these files are outputted.
Reporter | ||
Updated•14 years ago
|
Reporter | ||
Comment 1•14 years ago
|
||
Reporter | ||
Comment 2•14 years ago
|
||
Comment on attachment 459348 [details]
Testcase
This HTML document outputs the names of all files that are dropped onto the rectangle.
Reporter | ||
Comment 3•14 years ago
|
||
I added support for the CFSTR_FILEGROUPDESCRIPTOR and CFSTR_FILECONTENTS Clipboard Format. When someone requests the dropped files from event.datatransfer.files and the filenames are not available via CF_HDROP, Firefox checks if virtual files are available via CFSTR_FILEGROUPDESCRIPTOR and CFSTR_FILECONTENTS. The contents are written to temporary files in %TMP% and the filenames are returned as the data. The JavaScript-Program does not know the difference whether this are real files or objects from the Clipboard. With this change it is possible to drag and drop E-Mails, Contacts, Notes, etc. from Outlook to a Webapplication as if they were files on the filesystem.
Comment on attachment 459755 [details] [diff] [review] Patch to support Drag and Drop of E-Mails from Outlook I'm going to bounce this over to Jim Mathies -- I believe he knows the D&D code better than I do..
Comment 5•14 years ago
|
||
Comment on attachment 459755 [details] [diff] [review] Patch to support Drag and Drop of E-Mails from Outlook >+ if (S_OK == hres) { Generally could we switch to using success macros with these where it applies? If not, lets at least start getting this code better in line with mozilla coding standard and set the comparison order right, so |if (hres != S_OK)| good, |if (S_OK == hres)| bad. Also, in the default: block, could you try breaking that up into a set of functions or methods as much as possible? It's grown pretty wild and crazy. >+ if (wcslen(tmpname) == 0) { |if (!wcslen(tmpname))| or actually, maybe tighten this up a bit: LPFILEGROUPDESCRIPTOR fgdesc = (LPFILEGROUPDESCRIPTOR) GlobalLock(stm.hGlobal); if (fgdesc) { GetTempFilepath((fgdesc->fgd)[aIndex].cFileName, tmpname); } hres = (!wcslen(tmpname) ? E_FAIL : S_OK); GlobalUnlock(stm.hGlobal); or.. how about GetTempFilepath return a result for hres? I think if we work through a bit we could cut down on the amount of code quite a it. >+ if (S_OK == hres) { >+ hres = StgCreateDocfile(tmpname, STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &file); >+ } >... >+ file->Release(); >+ } Could we tighten this up? Looks like all the file manipulation code could sit in that first if block. This and the else block could likely be broken out into functions. >+ if (buffer) { >... >+ else { >+ result = NS_ERROR_OUT_OF_MEMORY; >+ } If you've already released, might as well check for error first and just return. On GetTempFilepath, we have some code in nsDataObj for generating a random filename string. Maybe we could re-use that. Not sure, but I don't like this repetitive opening of files with names from 1-10000. :) Pick a string, try to open it, and fail generally with a warning maybe if it doesn't work. You might look at nsILocalFileWin, we might have a getuniquetempfile routine in there that could replace all of this. >+ else { >+ *aNumItems = 1; >+ } >+ ReleaseStgMedium(&stm); >+ } >+ else { >+ *aNumItems = 1; >+ } >+ } >+ else { >+ *aNumItems = 1; >+ } >+ } Maybe set *aNumItems = 1 and reset it to zero on error? Mostly just code format / logic nits here so far Michael. It's a great start, we need support for this. Please clean things up a bit and repost so we can get to the meat of what you're trying to do here.
Reporter | ||
Comment 6•14 years ago
|
||
I took your advice and made some changes. 1. I made two seperate methods SaveIStorage and SaveIStream. 2. GetTempFilepath now returns a nsresult and uses the CreateUnique-Method of nsILocalFile. 3. I changed "if (S_OK == hres)" to "if (FAILED(hres))" but I could not instantly return on error because there is a ReleaseStgMedium at the end of the function which has to be called. 4. StgCreateDocfile was deprecated so I changed it to StgCreateStorageEx and made some other minor tweaks.
Hi, Is there any Timetable, when this feature could be integrated into a release build? best regards martin
Comment 8•13 years ago
|
||
Comment on attachment 462345 [details] [diff] [review] Patch to support Drag and Drop of E-Mails from Outlook Review of attachment 462345 [details] [diff] [review]: Is there privacy leakage potential here? Who cleans up the files we create? Maybe if the call wants a file this is ok as they will clean it up? (I promise I'll swing back around on this sooner this time, sorry for the review delay.) ::: widget/src/windows/nsClipboard.cpp @@ +420,5 @@ hres = FillSTGMedium(aDataObject, format, &fe, &stm, TYMED_HGLOBAL); + // If the format is CF_HDROP and we haven't found any files we can try looking + // for virtual files with FILEDESCRIPTOR. + if ((hres != S_OK) && (format == CF_HDROP)) { No need for the added parens here, just if (hres != S_OK && format == CF_HDROP) { or if (FAILED(hres) && format == CF_HDROP) { @@ +526,5 @@ + hres = GetTempFilepath(nsDependentString((fgdesc->fgd)[aIndex].cFileName), tmppath); + } + else { + hres = E_FAIL; + } nit - hres = E_FAIL; if (fgdesc) { hres = GetTempFilep... } @@ +1018,5 @@ + + NS_ENSURE_ARG_POINTER(aDataObject); + SET_FORMATETC(fe, RegisterClipboardFormat(CFSTR_FILECONTENTS), 0, DVASPECT_CONTENT, aIndex, TYMED_ISTORAGE); + hres = aDataObject->QueryGetData(&fe); + NS_ENSURE_SUCCESS(hres, hres); NS_ENSURE_SUCCESS checks mozilla return results, but in here looks like we are dealing with COM error codes? In which case this would have unexpected results. (There are three more below this, and a couple more in SaveIStream.) @@ +1033,5 @@ + file->Commit(0); + file->Release(); /* Should we release the IStorage in case CopyTo failes? */ + ReleaseStgMedium(&stm); + + return hres; Mixing return values here, we are returning an HRESULT as an nsresult. Same for SaveIStream. @@ +1051,5 @@ + + hres = aDataObject->GetData(&fe, &stm); + NS_ENSURE_SUCCESS(hres, hres); + + char buffer[4096] = {0}; /* What would be a good buffersize? */ Let's define that above the method, or use some msdn constant instead. ::: widget/src/windows/nsDragService.cpp @@ +427,5 @@ + FORMATETC fe2; + SET_FORMATETC(fe2, nsClipboard::CF_FILEDESCRIPTOR, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL); + if (mDataObject->QueryGetData(&fe2) == S_OK) { + STGMEDIUM stm; + if (mDataObject->GetData(&fe2, &stm) == S_OK) { SUCCEEDED() on these two please.
Hi, this patch was deployed by our former employee. Is there anything left we should submit so that this patch will have a chance to get into the release build? regards, Martin
Updated•13 years ago
|
Comment 10•13 years ago
|
||
Hi, Are there still open tasks before this patch will be applied? Bye, Juergen
Updated•11 years ago
|
Comment 11•11 years ago
|
||
Really looking forward to this, right now there is no way to drag and drop Mails into HTML forms. Any chance to get this included anytime soon?
Comment 12•11 years ago
|
||
I'm working on some other drag-and-drop issues so I'll take a look at this
Comment 13•10 years ago
|
||
It would be very helpful, if your fix would also work for the drag and drop of email attachments.
Comment 14•10 years ago
|
||
(In reply to Tim Abraldes [:TimAbraldes] [:tabraldes] from comment #12) > I'm working on some other drag-and-drop issues so I'll take a look at this Hi Tim, Where are you with this issue? Do you need any assistance? Our company may be available to help get this patch ready for release. Brendan
Comment 15•10 years ago
|
||
(In reply to Brendan Doherty from comment #14) > Where are you with this issue? Do you need any assistance? Our company > may be available to help get this patch ready for release. Half-a-year ago I was working on an effort to rewrite our clipboard and drag&drop functionality on Windows, which is why I picked up this bug. That rewrite lost steam as other priorities picked up and is now in a state of bitrot. I still think our clipboard and d&d code needs an overhaul and I'd like to work on this in the future, but I'm unassigning myself for now since I'm not working on it currently and haven't been for about 6 months.
Comment 16•9 years ago
|
||
Sorry to jump in so late in the day!! My company has recently moved away from Lotus Notes for which the drag-and-drop from an email worked fine, but now we have migrated to Outlook the drag-and-drop from an email no longer works. Just wondering if there are any potential solutions on the horizons?? Thanks, Liam
Comment 17•8 years ago
|
||
This isn't a Firefox-specific solution, but there's a product called Outlook2Web which you can install on Windows PCs and will enable drag and drop to websites in Firefox and other browsers. It's at http://outlook2web.com/
Updated•8 years ago
|
Updated•8 years ago
|
Updated•7 years ago
|
Updated•7 years ago
|
Comment 18•5 years ago
|
||
Just as an FYI: Microsoft has started to actively work on integrating OLE streams with Chromium's Drag & Drop support and is currently in the Code Review phase:
https://bugs.chromium.org/p/chromium/issues/detail?id=322605
I'm estimating that Google Chrome and the new Chromium-based Edge will support Drag & Drop from Outlook sometime in Q2/2019 (i.e. Chromium 76 or 77). Microsoft Edge (without Chromium) has supported Drag & Drop since Windows 10 v1709.
This will make Firefox the only major browser on Windows that doesn't have support for Drag & Drop from Outlook.
Comment 19•5 years ago
|
||
DragDrop from Outlook to Edge/Chrome is now working. This is a major disadvantage for Firefox and will lead many of our clients to use Chrome/Edge.
Comment 20•5 years ago
|
||
+1 This is a major issue for our customers and support staff since years. Customer's IT usually blocks all Outlook AddIn solutions necessary to remedy this, in particular as they not only store temporary files, but install hooks into Outlook DLLs which IMHO is an evil hack and not how it should be! For reference, look at the code of the open source plugin (https://github.com/tonyfederer/OutlookFileDrag) which uses EasyHook, others obviously use things like MS Detours, but that really can't be it.
As both Edge (old and new) and Chrome support this now, it's rather hard to recommend Firefox anymore, as our software heavily uses file uploads from all kinds of file sources and the only place where it's not possible (without saving a mail to desktop before, that is, which is really cumbersome) is that fine Outlook product. Unfortunately, 95% of our customers use that. Being a Firefox fan since it initially came out and using it as my premier development browser, even I find myself more and more turning to Edge these days just because of convenience. It would really be nice if this feature could be integrated into Firefox too, otherwise it's a major disadvantage indeed and would be a real pity.
Thanks for the hard work, in any case,
-- Ch.
Comment 21•4 years ago
|
||
It's a shame that Firefox is so late to the game regarding this feature, when Firefox could have beaten the other browsers by 10+ years (going by the age of this request). It seems like a small feature, but on the enterprise side employees commonly move email attachments between Outlook and web apps on a regular basis; it really does become a deciding factor when evaluating Firefox vs Chrome and Edge (both of which support the requested feature). Firefox missed the chance to be first with this feature, and now it's the only browser without it.
Comment 22•4 years ago
|
||
Comment 23•4 years ago
|
||
Sadly we had to recommend to our customers to switch to the edge browser, because drag and drop from Outlook is still not supported in Firefox.
Hopefully this feature will come soon. Are there any news on this?
Comment hidden (metoo) |
Comment hidden (metoo) |
Comment hidden (metoo) |
Updated•3 years ago
|
Comment hidden (metoo) |
Comment hidden (metoo) |
Comment hidden (metoo) |
Comment hidden (metoo) |
Comment 31•3 years ago
|
||
Hi,
i have the same problem with a customer only in firefox.
I would understand why it works in this fiddle (from https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/files):
https://jsbin.com/hiqasek/edit?html,js,output
https://jsfiddle.net/9C2EF/
There is only a div with on-Events.
I copy the div and the javascript but it don´t work.
Can anyone explain it?
Comment 32•3 years ago
|
||
(In reply to schlesier from comment #31)
Hi,
i have the same problem with a customer only in firefox.
I would understand why it works in this fiddle (from https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/files):
https://jsbin.com/hiqasek/edit?html,js,output
https://jsfiddle.net/9C2EF/There is only a div with on-Events.
I copy the div and the javascript but it don´t work.Can anyone explain it?
Maybe I don't understand the problem correctly, but as I see it, the Fiddles work when dragging files from Explorer, but not from Outlook. That is because Firefox only supports HTML5 drag/drop and expects a CF_HDROP flavor, that is, a physical file. When dragging Mails out of Outlook, Outlook uses a different format (CFSTR_FILEDESCRIPTORW and such, virtual files) Firefox doesn't support while Edge and Chrome do. So even if the final result would be a .msg file on disk, it is not so when dragging to a web app. One could argue that Firefox sticks with the standard and Microsoft should change Outlook instead (Lotus did), they simply won't. So the current situation is that you cannot drag Outlook messages to your web app while in Edge (including the Legacy one) and Chrome it is possible without fuss. The only workaround are Outlook plugins like https://tonyfederer.github.io/OutlookFileDrag/ and such, but these hack into the internal Windows APIs, store the message on disk first and deliver a physical file afterwards. For 99.9 of enterprise customers, that is not a viable solution because of security issues, along with side effects inside Outlook. All in all, for any web app that has to deal with Outlook files somewhere, Firefox is no viable alternative anymore altogether. This is a real PITA as it was our recommended platform for years and the browser we still use in development because of the telemetry concerns of the others, but unless Mozilla recognizes that this is a real important issue and not an edge case and goes beyond the HTML5 standard here too, they're more or less out of the enterprise market and that is a pity. So far, Edge has won this field.
HTH,
-- Ch.
Comment 33•3 years ago
|
||
(In reply to C. Bollmeyer from comment #32)
(In reply to schlesier from comment #31)
Hi,
i have the same problem with a customer only in firefox.
I would understand why it works in this fiddle (from https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/files):
https://jsbin.com/hiqasek/edit?html,js,output
https://jsfiddle.net/9C2EF/There is only a div with on-Events.
I copy the div and the javascript but it don´t work.Can anyone explain it?
Maybe I don't understand the problem correctly, but as I see it, the Fiddles work when dragging files from Explorer, but not from Outlook. That is because Firefox only supports HTML5 drag/drop and expects a CF_HDROP flavor, that is, a physical file. When dragging Mails out of Outlook, Outlook uses a different format (CFSTR_FILEDESCRIPTORW and such, virtual files) Firefox doesn't support while Edge and Chrome do. So even if the final result would be a .msg file on disk, it is not so when dragging to a web app. One could argue that Firefox sticks with the standard and Microsoft should change Outlook instead (Lotus did), they simply won't. So the current situation is that you cannot drag Outlook messages to your web app while in Edge (including the Legacy one) and Chrome it is possible without fuss. The only workaround are Outlook plugins like https://tonyfederer.github.io/OutlookFileDrag/ and such, but these hack into the internal Windows APIs, store the message on disk first and deliver a physical file afterwards. For 99.9 of enterprise customers, that is not a viable solution because of security issues, along with side effects inside Outlook. All in all, for any web app that has to deal with Outlook files somewhere, Firefox is no viable alternative anymore altogether. This is a real PITA as it was our recommended platform for years and the browser we still use in development because of the telemetry concerns of the others, but unless Mozilla recognizes that this is a real important issue and not an edge case and goes beyond the HTML5 standard here too, they're more or less out of the enterprise market and that is a pity. So far, Edge has won this field.
HTH,
-- Ch.
Thank you for your comment!
But it works from outlook, you can try it. Just drag a mail to the fiddle and there is a file-Object in the "event.DataTransfer.files"-List.
Maybe there is some magic JavaScript like jQuery that make it possible. I would like to understand it.
Comment 34•3 years ago
|
||
(In reply to schlesier from comment #33)
(In reply to C. Bollmeyer from comment #32)
(In reply to schlesier from comment #31)
Hi,
i have the same problem with a customer only in firefox.
I would understand why it works in this fiddle (from https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/files):
https://jsbin.com/hiqasek/edit?html,js,output
https://jsfiddle.net/9C2EF/There is only a div with on-Events.
I copy the div and the javascript but it don´t work.Can anyone explain it?
Maybe I don't understand the problem correctly, but as I see it, the Fiddles work when dragging files from Explorer, but not from Outlook. That is because Firefox only supports HTML5 drag/drop and expects a CF_HDROP flavor, that is, a physical file. When dragging Mails out of Outlook, Outlook uses a different format (CFSTR_FILEDESCRIPTORW and such, virtual files) Firefox doesn't support while Edge and Chrome do. So even if the final result would be a .msg file on disk, it is not so when dragging to a web app. One could argue that Firefox sticks with the standard and Microsoft should change Outlook instead (Lotus did), they simply won't. So the current situation is that you cannot drag Outlook messages to your web app while in Edge (including the Legacy one) and Chrome it is possible without fuss. The only workaround are Outlook plugins like https://tonyfederer.github.io/OutlookFileDrag/ and such, but these hack into the internal Windows APIs, store the message on disk first and deliver a physical file afterwards. For 99.9 of enterprise customers, that is not a viable solution because of security issues, along with side effects inside Outlook. All in all, for any web app that has to deal with Outlook files somewhere, Firefox is no viable alternative anymore altogether. This is a real PITA as it was our recommended platform for years and the browser we still use in development because of the telemetry concerns of the others, but unless Mozilla recognizes that this is a real important issue and not an edge case and goes beyond the HTML5 standard here too, they're more or less out of the enterprise market and that is a pity. So far, Edge has won this field.
HTH,
-- Ch.Thank you for your comment!
But it works from outlook, you can try it. Just drag a mail to the fiddle and there is a file-Object in the "event.DataTransfer.files"-List.
Maybe there is some magic JavaScript like jQuery that make it possible. I would like to understand it.
No, unfortunately it does not. Both Fiddles state "File Count: 0" after dropping a mail from Outlook to Firefox. Obviously the handler gets called, but the dataTransfer object is empty and does not contain any file data (which is expected if the d&d flavor is not recognized). If you drag a file from the desktop, it correctly retrieves that info. Latest Firefox (94.0) and Outlook (365 standalone) here. If I drag&drop the same message to the Fiddle in Edge, it works as wished for:
File Count: 1
File 0:
(object) : <[object File] > Bug 580928 Drag and Drop support for E-Mails from Microsoft Outlook.msg 157184
In Firefox, it does not.
-- Ch.
Comment 35•3 years ago
|
||
Strange, I could have sworn it worked yesterday. But I probably had too many browsers open. Anyway, thanks for the replies. Let's wait and see if Mozillla changes anything next year.
Assignee | ||
Comment 37•2 years ago
|
||
Updated•2 years ago
|
Assignee | ||
Comment 38•2 years ago
|
||
Comment on attachment 9295144 [details]
Bug 580928 - Add support for Drag and Drop with Outlook items. r?cmartin
I rebased the patch and fixed any compiler errors caused by its age. Also, I tried to address the feedback from the most recent review on this bug to the best of my ability, although I am not a C++ developer.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment hidden (metoo) |
Comment 41•1 year ago
|
||
In 1800617 should this bug be fixed, but with which version of firefox will this fix be released? I have tested with the current version of firefox (v. 108), beta (v.109.0b2) and nightly (v.110.0a1) and the problem still exists (mails or attachments from mails from outlook cannot be dropped into input field in firefox)
Best regards
Comment 42•1 year ago
|
||
This bug hasn't been fixed in any version of Firefox. We are currently waiting on marco.spiess to address the last review feedback.
Updated•1 year ago
|
Updated•1 year ago
|
Comment hidden (advocacy) |
Comment 44•1 year ago
|
||
I've found a temporary solution for this problem. Unfortunately it is not for free. You can take a look for yourself at www.dragdrop.com. It's company located in the Netherlands which created this software.
Nevertheless the Mozilla-Foundation should try to fix this issue and catch up with the two other browser competitors Edge and Chrome which supports this out of the box.
Updated•1 year ago
|
Updated•1 year ago
|
Comment 47•1 year ago
|
||
Would be nice to get this done and it seems there isn't much left to do. Marco did you see the last few review comments?
Updated•1 year ago
|
Updated•1 year ago
|
Comment 48•1 year ago
|
||
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/a4b80c7849fe Add support for Drag and Drop with Outlook items. r=cmartin
Comment 49•1 year ago
|
||
bugherder |
Comment 50•1 year ago
|
||
Hooray, thank you very much for driving this cross the completion line, marco.spiess !!!
Comment 51•1 year ago
|
||
+1. It's great to see this fixed. I hope someone on Windows with Outlook can confirm that this is working after this makes it into Nightly in a few hours.
Comment 52•1 year ago
|
||
I'm thinking we'll want to call this out in the Fx113 relnotes. Can you please nominate it when you get a chance?
Comment 53•1 year ago
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]: It's a 13-year-old feature that a fair amount of enterprise users have requested.
[Affects Firefox for Android]: No
[Suggested wording]: A 13-year-old feature request was fulfilled, and Firefox now supports files being drag-and-dropped directly from Microsoft Outlook. A special thanks to volunteer contributor Marco Spiess for getting this across the finish line!
[Links (documentation, blog post, etc)]:
Comment 54•1 year ago
•
|
||
I also would like to thank Marco personally on here. Thank you for fixing this, and for putting up with my code review 😂. I think it turned out very well 😀
Comment 55•1 year ago
|
||
(In reply to Tom S [:evilpie] from comment #51)
+1. It's great to see this fixed. I hope someone on Windows with Outlook can confirm that this is working after this makes it into Nightly in a few hours.
I just played with it with the testcase https://bugzilla.mozilla.org/attachment.cgi?id=459348 . And yes, it works well :)
Assignee | ||
Comment 56•1 year ago
|
||
No need to thank me! The gratitude should be directed towards michael.schoendorfer for laying the groundwork and towards all the reviewers for putting up with my nonsense 😂
And special thanks to Martin for seeing this thing through to the end 🙂
Description
•