Drag a .NET application from an email application to GroupWise.

I am trying to allow an attachment from an email opened in Novell GroupWise to be deleted in my C # WinForms application. The standard .NET functionality does not work.

In the DragDrop event of the e.Data.GetFormats () control, returns the following.

FileGroupDescriptorW FileGroupDescriptor FileContents attachment format 

I can get the file name with e.Data.GetData ("FileGroupDescriptor") and go to position 76.

Unfortunately, e.Data.GetData ("FileContents") raises the first case of a System.NotImplementedException in System.Windows.Forms.dll and returns null. The attachment format also returns null.

My searches tell me that dragging and dropping is a lot more complicated than I thought :) It seems that GroupWise can use the CFSTR_FILECONTENTS format, but this is just an assumption. Attachments can be successfully dragged to the Windows desktop or other folders.

Thanks for any suggestions.

+4
source share
1 answer

I also could not find it. Here is what I came up with (Groupwise 7):

 private void control_DragDrop(object sender, DragEventArgs e) { string strFilename = null; //something about the act of reading this stream creates the file in your temp folder(?) using (MemoryStream stream = (MemoryStream)e.Data.GetData("attachment format", true)) { byte[] b = new byte[stream.Length]; stream.Read(b, 0, (int)stream.Length); strFilename = Encoding.Unicode.GetString(b); //The path/filename is at position 10. strFilename = strFilename.Substring(10, strFilename.IndexOf('\0', 10) - 10); stream.Close(); } if (strFilename != null && File.Exists(strFilename)) { //From here on out, you're just reading another file from the disk... using(FileStream fileIn = File.Open(strFilename, FileMode.Open)) { //Do your thing fileIn.Close(); } } File.Delete(strFilename); } 
+2
source

All Articles