MS12.02.2016
This commit is contained in:
@@ -19,46 +19,7 @@ Public Class ClassDragDrop
|
||||
' ListBox1.Items.Add(MyFiles(i))
|
||||
Next
|
||||
Return True
|
||||
ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then
|
||||
Dim oApp
|
||||
Try
|
||||
oApp = New Outlook.Application()
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler bei Initialisieren von Outlook-API:" & vbNewLine & ex.Message & vbNewLine & vbNewLine & "Evtl ist Outlook nicht in der dafür vorgesehenen For")
|
||||
End Try
|
||||
|
||||
ClassLogger.Add(">> Drop of msg", False)
|
||||
'supports a drop of a Outlook message
|
||||
Dim myobj As Object
|
||||
For i As Integer = 1 To oApp.ActiveExplorer.Selection.Count
|
||||
myobj = oApp.ActiveExplorer.Selection.Item(i)
|
||||
Dim subj As String = myobj.Subject
|
||||
If subj.Contains("\") Then
|
||||
subj = subj.Replace("\", "-")
|
||||
End If
|
||||
If subj.Contains("/") Then
|
||||
subj = subj.Replace("/", "-")
|
||||
End If
|
||||
'hardcode a destination path for testing
|
||||
Dim strFile As String = IO.Path.Combine(Path.GetTempPath, (subj + ".msg").Replace(":", ""))
|
||||
strFile = strFile.Replace("?", "")
|
||||
strFile = strFile.Replace("!", "")
|
||||
strFile = strFile.Replace("%", "")
|
||||
strFile = strFile.Replace("$", "")
|
||||
ClassLogger.Add(">> Drop of msg - File:" & strFile, False)
|
||||
Try
|
||||
myobj.SaveAs(strFile)
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in Save Email2Tempfile" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
ReDim Preserve files_dropped(i)
|
||||
files_dropped(i) = "@OUTLOOK_MESSAGE@" & strFile
|
||||
Next
|
||||
Return True
|
||||
'Drop eines Outlook Attachments
|
||||
ElseIf (e.Data.GetDataPresent("aryFileGroupDescriptor")) AndAlso (e.Data.GetDataPresent("FileContents")) Then
|
||||
ElseIf (e.Data.GetDataPresent("FileGroupDescriptor")) AndAlso (e.Data.GetDataPresent("FileContents")) Then
|
||||
'// the first step here is to get the stbFileName
|
||||
'// of the attachment and
|
||||
'// build a full-path name so we can store it
|
||||
@@ -113,7 +74,46 @@ Public Class ClassDragDrop
|
||||
ClassLogger.Add(">> Attachment File from Outlook could not be created", False)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
If e.Data.GetDataPresent("FileGroupDescriptor") Then
|
||||
Dim oApp
|
||||
Try
|
||||
oApp = New Outlook.Application()
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler bei Initialisieren von Outlook-API:" & vbNewLine & ex.Message & vbNewLine & vbNewLine & "Evtl ist Outlook nicht in der dafür vorgesehenen For")
|
||||
End Try
|
||||
|
||||
ClassLogger.Add(">> Drop of msg", False)
|
||||
'supports a drop of a Outlook message
|
||||
Dim myobj As Object
|
||||
For i As Integer = 1 To oApp.ActiveExplorer.Selection.Count
|
||||
myobj = oApp.ActiveExplorer.Selection.Item(i)
|
||||
Dim subj As String = myobj.Subject
|
||||
If subj.Contains("\") Then
|
||||
subj = subj.Replace("\", "-")
|
||||
End If
|
||||
If subj.Contains("/") Then
|
||||
subj = subj.Replace("/", "-")
|
||||
End If
|
||||
'hardcode a destination path for testing
|
||||
Dim strFile As String = IO.Path.Combine(Path.GetTempPath, (subj + ".msg").Replace(":", ""))
|
||||
strFile = strFile.Replace("?", "")
|
||||
strFile = strFile.Replace("!", "")
|
||||
strFile = strFile.Replace("%", "")
|
||||
strFile = strFile.Replace("$", "")
|
||||
ClassLogger.Add(">> Drop of msg - File:" & strFile, False)
|
||||
Try
|
||||
myobj.SaveAs(strFile)
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in Save Email2Tempfile" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
ReDim Preserve files_dropped(i)
|
||||
files_dropped(i) = "@OUTLOOK_MESSAGE@" & strFile
|
||||
Next
|
||||
Return True
|
||||
'Drop eines Outlook Attachments
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in Drop-File" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
|
||||
Reference in New Issue
Block a user