views:

67

answers:

1

In Outlook 2003/2007 you can drag files from Explorer into its main window and message editing windows to attach a file.

But how can I use my own C# app in place of Explorer to do this? Do I need to extend Outlook (by hooking into COM events or otherwise), or does my C# app need to do something special in its drag/drop event handlers?

A: 

Here's a code snippet.

In this example I have a button on my Windows Form that I will use as the Drag And Drop source.

string[] fileList = new string[] { @"c:\temp\myVideo.avi" };
DataObject fileDragData = new DataObject(DataFormats.FileDrop, fileList);
button1.DoDragDrop(fileDragData, DragDropEffects.All);
Magnus Johansson
Thank you Magnus. Worked right away...
Mads