ERLEDIGT
JA
JA
ANTWORTEN
3
3
ZUGRIFFE
1615
1615
EMPFEHLEN
-
19.05.10 10:58 #1
- Registriert seit
- May 2008
- Ort
- Sydney, Australien
- Beiträge
- 87
Guten Morgen NET Gemeinde,
Ich habe ein Program welches mir erlaubt eine Mail von Outllok via Drag and Drop in ein von mir
bestimmtes Verzeichnis kopiert. Alles funktioniert wunderbar auf meinem privaten Rechner.
Jetzt wollte ich diese Program heute auf meinen Arbeitsrechner benutzen und siehe da, es funktioniert
nicht zu 100%. Das Program legt normale Mails ohne Anhang an, jedoch wenn ich einen Anhang habe,
bekomme ich folgende Fehler Meldung:
Ich verstehe nicht warum es auf meinen privaten Rechner funktioniert und auf dem Arbeitsrechner nicht.HTML-Code:An error occured in the drop event System.IO.Directory Not FoundException: Operation failed. at Microsoft.Office.Interop._Mailitem.SaveAs(String Path, Object Type) at WindowsApplication1.Form1.Label1_DragDrop
Privater Rechner läuft mit XP und Office 2007.
Arbeitsrechner läuft auf Vista und Office 2007.
Hier mein Code:
HTML-Code:Option Strict On Public Class Form1 Dim objOL As New Microsoft.Office.Interop.Outlook.Application ''' <summary> ''' </summary> ''' <param name="sender"></param> ''' <param name="e"></param> ''' <remarks></remarks> Private Sub Label1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Label1.DragDrop lblFile.Text = String.Empty Try If e.Data.GetDataPresent(DataFormats.FileDrop) Then Dim draggedFiles As String() = CType(e.Data.GetData(DataFormats.FileDrop), String()) For Each fileName As String In draggedFiles Dim strDestinationFile As String = _ IO.Path.Combine("C:\test", _ IO.Path.GetFileName(fileName)) If strDestinationFile.Trim.ToUpper = fileName.Trim.ToUpper Then lblFile.Text += strDestinationFile + _ " - Source and Destination are the same" + _ Environment.NewLine Else lblFile.Text += "Copying - " + _ strDestinationFile + Environment.NewLine IO.File.Copy(fileName, strDestinationFile) End If Next ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then Dim objMI As Microsoft.Office.Interop.Outlook.MailItem For Each objMI In objOL.ActiveExplorer.Selection() Dim strFile As String = _ IO.Path.Combine("C:\test", _ (" " + objMI.SenderName + " to " + objMI.ReceivedByName + " - " + objMI.Subject + ".msg").Replace(":", "")) ' " " +objMI.ReceivedByName + " " + objMI.SenderName + " " + objMI.Subject + '" " +objMI.To + " " + objMI.SenderEmailAddress + " " + objMI.Subject + lblFile.Text += strFile + Environment.NewLine objMI.SaveAs(strFile) Next End If lblFormat.Text = String.Empty Catch ex As Exception lblFile.Text = "An error occured in the drop event" + Environment.NewLine + ex.ToString End Try End Sub ''' <summary> ''' </summary> ''' <param name="sender"></param> ''' <param name="e"></param> ''' <remarks></remarks> Private Sub Label1_DragLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.DragLeave lblFormat.Text = String.Empty End Sub ''' <summary> ''' </summary> ''' <param name="sender"></param> ''' <param name="e"></param> ''' <remarks></remarks> Private Sub Label1_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Label1.DragOver If e.Data.GetDataPresent(DataFormats.FileDrop) Then e.Effect = DragDropEffects.Copy lblFormat.Text = "DragOver ... File drop" ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then e.Effect = DragDropEffects.Copy lblFormat.Text = "DragOver ... Outlook" Else e.Effect = DragDropEffects.None lblFormat.Text = "" End If End Sub
Problem Fall 2.
Das Programm soll die Email unter folgenden Aspekten speichern:
Datum Uhrzeit Sender Empfänger Subject
Sender, Empfänger und Subject kein Problem aber mit Datum funktioniert es nicht mal auf meinen Privaten rechner.
Ich versuchte für Sender folgenden code: objMI.Sent
Ich hoffe das mir jemand Helfen kann.
Vielen Dank
-
19.05.10 14:53 #2
Vielleicht liegt es ja an den erhöhten Sicherheitseinstellungen von Vista...UAC usw.
What was hard to code should be hard to read, too******
-
20.05.10 11:37 #3
- Registriert seit
- May 2008
- Ort
- Sydney, Australien
- Beiträge
- 87
Danke für deinen Beitrag. Ich denke nicht das es daran liegen wird, da ich normale Emails automatisch
speichern kann, nur nicht die Anhänge.
Hat jemand anders vielleicht noch eine idee?
-
24.05.10 09:14 #4
- Registriert seit
- May 2008
- Ort
- Sydney, Australien
- Beiträge
- 87
Hallo zusammen,
Ich habe nun folgendes Problem das, wenn ich versuche meine Email unter das eigegangende Datum und Uhrzeit zu speichern eine Fehler Meldung kommt,
da Outlook mit slashes die Nummern trennt. Hat jemand eine Ahnung wie ich das Format z.B. 20/05/2010 in 20-05-2010 umwandeln kann und das selbe mit dem
Doppelpunkt von der Uhrzeit?
Dazu kommt ist es moeglich wenn mir jemand im Subject ein "/" einfuegt dieses zu filtern und praktisch wegzulassen?
Ähnliche Themen
-
Drag&Drop aus Outlook
Von dyta im Forum .NET CaféAntworten: 1Letzter Beitrag: 30.03.10, 20:07 -
drag 'n drop funktioniert nicht nach rotation
Von mJc im Forum Flash PlattformAntworten: 4Letzter Beitrag: 21.02.09, 13:53 -
Drag&Drop funktioniert nicht richtig
Von Hookah im Forum Javascript & AjaxAntworten: 2Letzter Beitrag: 28.09.07, 12:43 -
Drag and Drop von ImageIcons funktioniert nicht
Von javaml im Forum Swing, Java2D/3D, SWT, JFaceAntworten: 1Letzter Beitrag: 18.04.07, 13:10 -
Wie funktioniert Drag and Drop im GataGrid-Feld?
Von Realworld im Forum Visual Basic 6.0Antworten: 0Letzter Beitrag: 06.07.03, 14:21





Zitieren
Login





