none
Outlook // .Net // Drag and Drop // DragDropEffects.Copy RRS feed

  • Question

  • Hello @All,

    to first, sorry for my bad english.

    I have a "small" problem.
    I processed datas in a DragDrop-Event. I drag the datas from Outlook and drop into a RTF control.

    Since I do not want to after editing, the Outlook inserts the data again (unprocessed) into the RTF control, I set e.Effects = DragDropEffects.None.

    This works well in Word, PDF, etc. at But Except for Outlook.  This acknowledges a e.Effects = DragDropEffects.None with an error "Error while performing operation." from Outlook. I set it on DragDropEffects.Copy or DragDropEffects.Link there are no problems.  (Except that then the processed data are also incorporated unprocessed by the DragAndDrop.)

    Sample code (w/o errorhandling):

    Private Sub RichTextBox1_DragEnter (ByVal sender As Object, _ ByVal e As System.Windows.Forms.DragEventArgs) Handles RichTextBox1.DragEnter 'The first still nothing happens e.effects = DragDropEffects.Copy End Sub Private Sub RichTextBox1_DragDrop (ByVal sender As Object, _ ByVal e As System.Windows.Forms.DragEventArgs) Handles RichTextBox1.DragDrop e.Effect = DragDropEffects.Copy mySetDataMSG2RTFDropMessage(e) '<--- the actual processing of data ' and inserting the processed ' data into the RichTextBox1 ' Here is the problem e.Effect = DragDropEffects.None End Sub Private Sub mySetDataMSG2RTFDropMessage(_data As System.Windows.Forms.DragEventArgs) Dim _MsgName As String = "" Dim _objOLApp As New Microsoft.Office.Interop.Outlook.Application If IsNothing(_objOLApp.ActiveExplorer) Then Exit Sub Dim _lauf As Integer For Each _OlItem As Microsoft.Office.Interop.Outlook.MailItem In _ _objOLApp.ActiveExplorer.Selection _lauf += 1 _MsgName = myCheckFileName("Mail-" & _lauf.ToString & ".msg") _MsgName = IO.Path.Combine(Globalvars.TempVerzeichnis, _MsgName) If FileIO.FileSystem.FileExists(_MsgName) Then FileIO.FileSystem.DeleteFile(_MsgName) End If _OlItem.SaveAs(_MsgName, Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSG) RichTextBox1.Text = RichTextBox1.Text & vbcrlf & _MsgName Next _objOLApp.Quit() End Sub

    This is the mistake:

    I need this:

    Is there a way without e.Effects to set to None, DragAndDrop cancel the operation without the Outlook complains?

    Thanks in advance

    Frank



    • Edited by Frank Pacher Thursday, September 12, 2013 9:38 AM
    Thursday, September 12, 2013 6:34 AM