Hi,
I am using the FileAttachmentBase to add files to a class in my project. Drag/Drop works great if I want to add a file from Windows Explorer. I want to be able to drag an attachment from Outlook and drop it into my application in the same way.
I have written and borrowed code to Drag/Drop from outlook as you can see in the attached sample project but I am having difficulty trapping the DragDrop event. The DragOver event works fine (although it seems that the AllowDrop is set to false after my code exists), but the DragDrop event is not trapped. If I drag and drop a file from Windows Explorer both events are trapped as expected.
Why is this?
Thanks,
Stephan
We have closed this ticket because another page addresses its subject:
FileAttachments Module - How to drag & drop file attachments from Outlook messages into ListView or DetailView with FileData objects
Hi Stephan,
Thank you for your sample project, but it seems that solution to this problem is a bit complex. This is what I have found over in the Microsoft forums:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=13748&SiteID=1
I think we need to have a built-in option to support dragging files not only from Explorer but from Outlook too. For this purpose, I have registered a new suggestion: ID S19805 (Modules.FileAttachment - Add the ability to drag & drop file attachments from Outlook messages). We will look into it.
Thanks,
Dennis
Hi,
Thanks for the info. My big problem at the moment however is that the DragDrop event does not fire in my code. Does your code suppress the event?
Thanks,
Stephan
Hi Stephan,
Thank you for the update. We are working on this problem and will post a solution once it is found. Please bear with us.
Thanks,
Dennis
Hi Stephan,
>>
Does your code suppress the event?
<<
Yes, we have the following code in the FileAttachmentListViewController class:
private void grid_DragOver(object sender, DragEventArgs e) { if(addFromFileAction.Active && e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = DragDropEffects.Copy; } else { e.Effect = DragDropEffects.None; } }
It suppresses the dropping of the file. So, the only way to accomplish your task is to modify and recompile our sources.
Thanks,
Dennis