2009-05-22 2 views
4

Novell GroupWise에서 열려있는 전자 메일의 첨부 파일을 C# WinForms 응용 프로그램에 놓을 수있게하려고합니다. 표준 .NET 기능이 작동하지 않습니다.GroupWise의 첨부 파일에서 .NET 응용 프로그램으로 전자 메일 첨부 파일로 끌어서 놓기

컨트롤의 DragDrop 이벤트에서 e.Data.GetFormats()는 다음을 반환합니다.

FileGroupDescriptorW 
FileGroupDescriptor 
FileContents 
attachment format 

내가 e.Data.GetData ("FileGroupDescriptor")와 파일 이름을 얻고 불행하게도 (76)

를 배치하려고 할 수 e.Data.GetData ("된 FileContents")는 첫 번째 기회 시스템의 원인 .NotImplementedException System.Windows.Forms.dll 및 null을 반환합니다. 첨부 파일 형식도 null을 반환합니다.

내 검색은 드래그 앤 드롭이 내가 생각한 것보다 훨씬 복잡하다고 말합니다. GroupWise가 CFSTR_FILECONTENTS라는 형식을 사용하고있는 것처럼 보이지만 그것은 단지 추측입니다. 첨부 파일을 Windows 바탕 화면이나 다른 폴더로 끌어서 놓을 수 있습니다.

의견을 보내 주셔서 감사합니다.

+1

Glad to know 나는 Groupwise와 함께 일해야하는 유일한 가난한 영혼이 아니다. – rjrapson

답변

2

나는 이것도 발견했다. 여기에 내가 생각해 낸 것이있다 (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); 
} 
+0

와우, 고마워. 아주 멋지 며 기묘합니다 .-) 당신은 맞습니다. 단순히 e.Data.GetData ("첨부 파일 형식") (실제로 필요한 경우 확실하지 않음)에 액세스하여 파일을 만듭니다. 여하튼 나는 그것이 전에 null을 돌려주고 있다고 생각했지만 혼란 스러웠을 것이다. 다시 한번 감사드립니다. 건배 로스 – tetranz

+0

불행히도 나를 위해 작동하지 않았다 - GetData null을 반환했습니다. – noelicus