From 3a223f44180662fcb2946f757faf6707ee5fe8fc Mon Sep 17 00:00:00 2001 From: Andreas Luxbauer Date: Tue, 10 Sep 2019 14:16:02 +0200 Subject: [PATCH] neu --- VERAGAddIn/My Project/AssemblyInfo.vb | 6 +- VERAGAddIn/My Project/Resources.Designer.vb | 2 +- VERAGAddIn/My Project/Settings.Designer.vb | 6 +- VERAGAddIn/Ribbon1.vb | 91 ------- VERAGAddIn/ThisAddIn.Designer.vb | 222 +++++++++--------- VERAGAddIn/VERAGAddIn.vbproj | 21 +- VERAGAddIn/app.config | 6 +- ...bbon1.Designer.vb => rbnVERAG.Designer.vb} | 2 + VERAGAddIn/{Ribbon1.resx => rbnVERAG.resx} | 0 VERAGAddIn/rbnVERAG.vb | 181 ++++++++++++++ 10 files changed, 319 insertions(+), 218 deletions(-) delete mode 100644 VERAGAddIn/Ribbon1.vb rename VERAGAddIn/{Ribbon1.Designer.vb => rbnVERAG.Designer.vb} (98%) rename VERAGAddIn/{Ribbon1.resx => rbnVERAG.resx} (100%) create mode 100644 VERAGAddIn/rbnVERAG.vb diff --git a/VERAGAddIn/My Project/AssemblyInfo.vb b/VERAGAddIn/My Project/AssemblyInfo.vb index 7db10bd..86ba961 100644 --- a/VERAGAddIn/My Project/AssemblyInfo.vb +++ b/VERAGAddIn/My Project/AssemblyInfo.vb @@ -22,7 +22,7 @@ Imports System.Security 'Die folgende GUID ist für die ID der typelib, wenn dieses Projekt für COM verfügbar gemacht wird - + ' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: ' @@ -35,8 +35,8 @@ Imports System.Security ' übernehmen, indem Sie "*" eingeben: ' - - + + Friend Module DesignTimeConstants Public Const RibbonTypeSerializer As String = "Microsoft.VisualStudio.Tools.Office.Ribbon.Serialization.RibbonTypeCodeDomSerializer, Microsoft.VisualStudio.Tools.Office.Designer, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" diff --git a/VERAGAddIn/My Project/Resources.Designer.vb b/VERAGAddIn/My Project/Resources.Designer.vb index 9c1fd98..0fc0a5b 100644 --- a/VERAGAddIn/My Project/Resources.Designer.vb +++ b/VERAGAddIn/My Project/Resources.Designer.vb @@ -22,7 +22,7 @@ Namespace My.Resources ''' ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. ''' - _ diff --git a/VERAGAddIn/My Project/Settings.Designer.vb b/VERAGAddIn/My Project/Settings.Designer.vb index 6a9c0e5..f12d62b 100644 --- a/VERAGAddIn/My Project/Settings.Designer.vb +++ b/VERAGAddIn/My Project/Settings.Designer.vb @@ -14,21 +14,21 @@ Option Explicit On _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) -#Region "Funktion zum automatischen Speichern von My.Settings" +#Region "Automatische My.Settings-Speicherfunktion" #If _MyType = "WindowsForms" Then Private Shared addedHandler As Boolean Private Shared addedHandlerLockObject As New Object _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) If My.Application.SaveMySettingsOnExit Then My.Settings.Save() End If diff --git a/VERAGAddIn/Ribbon1.vb b/VERAGAddIn/Ribbon1.vb deleted file mode 100644 index 9cc8dd9..0000000 --- a/VERAGAddIn/Ribbon1.vb +++ /dev/null @@ -1,91 +0,0 @@ -Option Explicit On - -Imports VERAG_PROG_ALLGEMEIN -Imports Microsoft.Office.Tools.Ribbon -Imports System.Windows.Forms -Imports Microsoft.Office.Interop -Imports VERAGAddIn.ThisAddIn - -Public Class VERAGRibbon - Dim LOGIN_OK = False - Public Shared Event bla() - Private Sub CustomerRibbon_Load(ByVal sender As System.Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonUIEventArgs) Handles MyBase.Load - - - End Sub - Private Function CreateRibbonDropDownItem() As RibbonDropDownItem - Return Me.Factory.CreateRibbonDropDownItem() - End Function - - Private Function CreateRibbonMenu() As RibbonMenu - Return Me.Factory.CreateRibbonMenu() - End Function - - Private Function CreateRibbonButton() As RibbonButton - Dim button As RibbonButton = Me.Factory.CreateRibbonButton() - ' AddHandler (button.Click), AddressOf Button_Click - Return button - End Function - - Private Sub Ribbon1_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load - VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False - Dim ADMIN As New cADMIN - LOGIN_OK = ADMIN.checkLogin("MAIL_USER", "VERAG_MAIL_USER_2017", "VERAG") - ' LOGIN_OK = ADMIN.checkLogin("MAIL_USER", "VERAG_MAIL_USER_2017", "ATILLA") - - End Sub - - Private Sub Button1_Click(sender As Object, e As RibbonControlEventArgs) - 'MsgBox("HI") - ' Dim ThisAddIn As New ThisAddIn - Dim s As String = "" - 'Dim app = ThisAddIn.getapp() - ' ThisAddIn.PrintAPageFromEmail() - RaiseEvent bla() - - End Sub - - - - - Private Sub Button2_Click(sender As Object, e As RibbonControlEventArgs) Handles Button2.Click - If LOGIN_OK Then - ' For Each ft As Form In My.Application.OpenForms - 'If ft.GetType.ToString = "AVISO.frmEintragAviso" Then - 'ft.BringToFront() - ' Exit Sub - ' End If - ' Next - - - - Dim EingangsDatum As Date = CDate("01.01.1990") - Try - Dim explorer As Outlook.Explorer = Globals.ThisAddIn.Application.ActiveExplorer - Dim selection As Outlook.Selection = explorer.Selection - If selection.Count > 0 Then - Dim selectedItem = selection(1) - Dim mailItem As Outlook.MailItem = selectedItem - If mailItem IsNot Nothing Then - EingangsDatum = mailItem.ReceivedTime - End If - End If - Catch ex As Exception - MsgBox(ex.Message) - End Try - - - VERAG_PROG_ALLGEMEIN.cGlobal.Aktive_ID = 0 - Dim mainForm As New AVISO.frmEintragAviso - If EingangsDatum > CDate("01.01.1990") Then - mainForm.EingangsDatum = EingangsDatum - End If - mainForm.TopMost = True - mainForm.StartFromOUTLOOK = True - mainForm.Show() - Else - MsgBox("Fehler beim Login!") - End If - - End Sub -End Class diff --git a/VERAGAddIn/ThisAddIn.Designer.vb b/VERAGAddIn/ThisAddIn.Designer.vb index 3c29eba..d7f71a5 100644 --- a/VERAGAddIn/ThisAddIn.Designer.vb +++ b/VERAGAddIn/ThisAddIn.Designer.vb @@ -14,61 +14,61 @@ Option Explicit On ''' - _ + _ Partial Public NotInheritable Class ThisAddIn Inherits Microsoft.Office.Tools.Outlook.OutlookAddInBase - + Friend WithEvents CustomTaskPanes As Microsoft.Office.Tools.CustomTaskPaneCollection - - _ + + _ Friend WithEvents Application As Microsoft.Office.Interop.Outlook.Application - + ''' - _ + _ Public Sub New(ByVal factory As Global.Microsoft.Office.Tools.Outlook.Factory, ByVal serviceProvider As Global.System.IServiceProvider) MyBase.New(factory, serviceProvider, "AddIn", "ThisAddIn") Globals.Factory = factory End Sub - + ''' - _ + _ Protected Overrides Sub Initialize() - MyBase.Initialize() + MyBase.Initialize Me.Application = Me.GetHostItem(Of Microsoft.Office.Interop.Outlook.Application)(GetType(Microsoft.Office.Interop.Outlook.Application), "Application") Globals.ThisAddIn = Me - Global.System.Windows.Forms.Application.EnableVisualStyles() - Me.InitializeCachedData() - Me.InitializeControls() - Me.InitializeComponents() - Me.InitializeData() + Global.System.Windows.Forms.Application.EnableVisualStyles + Me.InitializeCachedData + Me.InitializeControls + Me.InitializeComponents + Me.InitializeData End Sub - + ''' - _ + _ Protected Overrides Sub FinishInitialization() - Me.OnStartup() + Me.OnStartup End Sub - + ''' - _ + _ Protected Overrides Sub InitializeDataBindings() - Me.BeginInitialization() - Me.BindToData() - Me.EndInitialization() + Me.BeginInitialization + Me.BindToData + Me.EndInitialization End Sub - + ''' - _ + _ Private Sub InitializeCachedData() If (Me.DataHost Is Nothing) Then Return @@ -77,115 +77,115 @@ Partial Public NotInheritable Class ThisAddIn Me.DataHost.FillCachedData(Me) End If End Sub - + ''' - _ + _ Private Sub InitializeData() End Sub - + ''' - _ + _ Private Sub BindToData() End Sub - + ''' - _ + _ Private Sub StartCaching(ByVal MemberName As String) Me.DataHost.StartCaching(Me, MemberName) End Sub - + ''' - _ + _ Private Sub StopCaching(ByVal MemberName As String) Me.DataHost.StopCaching(Me, MemberName) End Sub - + ''' - _ + _ Private Function IsCached(ByVal MemberName As String) As Boolean Return Me.DataHost.IsCached(Me, MemberName) End Function - + ''' - _ + _ Private Sub BeginInitialization() - Me.BeginInit() - Me.CustomTaskPanes.BeginInit() + Me.BeginInit + Me.CustomTaskPanes.BeginInit End Sub - + ''' - _ + _ Private Sub EndInitialization() - Me.CustomTaskPanes.EndInit() - Me.EndInit() + Me.CustomTaskPanes.EndInit + Me.EndInit End Sub - + ''' - _ + _ Private Sub InitializeControls() Me.CustomTaskPanes = Globals.Factory.CreateCustomTaskPaneCollection(Nothing, Nothing, "CustomTaskPanes", "CustomTaskPanes", Me) End Sub - + ''' - _ + _ Private Sub InitializeComponents() End Sub - + ''' - _ + _ Private Function NeedsFill(ByVal MemberName As String) As Boolean Return Me.DataHost.NeedsFill(Me, MemberName) End Function - + ''' - _ + _ Protected Overrides Sub OnShutdown() - Me.CustomTaskPanes.Dispose() - MyBase.OnShutdown() + Me.CustomTaskPanes.Dispose + MyBase.OnShutdown End Sub End Class ''' - _ + _ Partial Friend NotInheritable Class Globals - + ''' Private Sub New() - MyBase.New() + MyBase.New End Sub - + Private Shared _ThisAddIn As ThisAddIn - + Private Shared _factory As Global.Microsoft.Office.Tools.Outlook.Factory - + Private Shared _ThisRibbonCollection As ThisRibbonCollection - + Private Shared _ThisFormRegionCollection As ThisFormRegionCollection - + Friend Shared Property ThisAddIn() As ThisAddIn Get Return _ThisAddIn End Get - Set(value As ThisAddIn) + Set If (_ThisAddIn Is Nothing) Then _ThisAddIn = value Else @@ -193,12 +193,12 @@ Partial Friend NotInheritable Class Globals End If End Set End Property - + Friend Shared Property Factory() As Global.Microsoft.Office.Tools.Outlook.Factory Get Return _factory End Get - Set(value As Global.Microsoft.Office.Tools.Outlook.Factory) + Set If (_factory Is Nothing) Then _factory = value Else @@ -206,7 +206,7 @@ Partial Friend NotInheritable Class Globals End If End Set End Property - + Friend Shared ReadOnly Property Ribbons() As ThisRibbonCollection Get If (_ThisRibbonCollection Is Nothing) Then @@ -215,7 +215,7 @@ Partial Friend NotInheritable Class Globals Return _ThisRibbonCollection End Get End Property - + Friend Shared ReadOnly Property FormRegions() As ThisFormRegionCollection Get If (_ThisFormRegionCollection Is Nothing) Then @@ -227,23 +227,23 @@ Partial Friend NotInheritable Class Globals End Class ''' - _ + _ Partial Friend NotInheritable Class ThisRibbonCollection Inherits Microsoft.Office.Tools.Ribbon.RibbonCollectionBase - + ''' Friend Sub New(ByVal factory As Global.Microsoft.Office.Tools.Ribbon.RibbonFactory) MyBase.New(factory) End Sub - - Default Friend Overloads ReadOnly Property Item(ByVal inspector As Microsoft.Office.Interop.Outlook.Inspector) As ThisRibbonCollection + + Friend Overloads Default ReadOnly Property Item(ByVal inspector As Microsoft.Office.Interop.Outlook.Inspector) As ThisRibbonCollection Get Return Me.GetRibbonContextCollection(Of ThisRibbonCollection)(inspector) End Get End Property - - Default Friend Overloads ReadOnly Property Item(ByVal explorer As Microsoft.Office.Interop.Outlook.Explorer) As ThisRibbonCollection + + Friend Overloads Default ReadOnly Property Item(ByVal explorer As Microsoft.Office.Interop.Outlook.Explorer) As ThisRibbonCollection Get Return Me.GetRibbonContextCollection(Of ThisRibbonCollection)(explorer) End Get @@ -251,33 +251,33 @@ Partial Friend NotInheritable Class ThisRibbonCollection End Class ''' - _ + _ Partial Friend NotInheritable Class ThisFormRegionCollection Inherits Microsoft.Office.Tools.Outlook.FormRegionCollectionBase - + ''' Public Sub New(ByVal list As System.Collections.Generic.IList(Of Microsoft.Office.Tools.Outlook.IFormRegion)) MyBase.New(list) End Sub - - Default Friend Overloads ReadOnly Property Item(ByVal explorer As Microsoft.Office.Interop.Outlook.Explorer) As WindowFormRegionCollection + + Friend Overloads Default ReadOnly Property Item(ByVal explorer As Microsoft.Office.Interop.Outlook.Explorer) As WindowFormRegionCollection Get - Return CType(Globals.ThisAddIn.GetFormRegions(explorer, GetType(WindowFormRegionCollection)), WindowFormRegionCollection) + Return CType(Globals.ThisAddIn.GetFormRegions(explorer, GetType(WindowFormRegionCollection)),WindowFormRegionCollection) End Get End Property - - Default Friend Overloads ReadOnly Property Item(ByVal inspector As Microsoft.Office.Interop.Outlook.Inspector) As WindowFormRegionCollection + + Friend Overloads Default ReadOnly Property Item(ByVal inspector As Microsoft.Office.Interop.Outlook.Inspector) As WindowFormRegionCollection Get - Return CType(Globals.ThisAddIn.GetFormRegions(inspector, GetType(WindowFormRegionCollection)), WindowFormRegionCollection) + Return CType(Globals.ThisAddIn.GetFormRegions(inspector, GetType(WindowFormRegionCollection)),WindowFormRegionCollection) End Get End Property End Class ''' - _ + _ Partial Friend NotInheritable Class WindowFormRegionCollection Inherits Microsoft.Office.Tools.Outlook.FormRegionCollectionBase - + ''' Public Sub New(ByVal list As System.Collections.Generic.IList(Of Microsoft.Office.Tools.Outlook.IFormRegion)) MyBase.New(list) diff --git a/VERAGAddIn/VERAGAddIn.vbproj b/VERAGAddIn/VERAGAddIn.vbproj index a0b9f54..41067af 100644 --- a/VERAGAddIn/VERAGAddIn.vbproj +++ b/VERAGAddIn/VERAGAddIn.vbproj @@ -26,7 +26,7 @@ Library VERAGAddIn VERAGAddIn - v4.5 + v4.6.1 VSTO40 @@ -36,8 +36,8 @@ D:\Andreas\Programmierung\VB\OutlookAddIN\BEREITSTELLUNG\ de - 1.0.0.27 - true + 1.0.0.43 + false true 7 days @@ -54,6 +54,11 @@ Microsoft .NET Framework 4.5 %28x86 and x64%29 true + + False + Microsoft .NET Framework 4.6.1 %28x86 und x64%29 + true + False .NET Framework 3.5 SP1 Client Profile @@ -206,17 +211,17 @@ --> - - Ribbon1.vb + + rbnVERAG.vb - + Component Code - - Ribbon1.vb + + rbnVERAG.vb diff --git a/VERAGAddIn/app.config b/VERAGAddIn/app.config index a029089..3c72f93 100644 --- a/VERAGAddIn/app.config +++ b/VERAGAddIn/app.config @@ -10,6 +10,10 @@ + + + + - \ No newline at end of file + diff --git a/VERAGAddIn/Ribbon1.Designer.vb b/VERAGAddIn/rbnVERAG.Designer.vb similarity index 98% rename from VERAGAddIn/Ribbon1.Designer.vb rename to VERAGAddIn/rbnVERAG.Designer.vb index 7ea9663..016c002 100644 --- a/VERAGAddIn/Ribbon1.Designer.vb +++ b/VERAGAddIn/rbnVERAG.Designer.vb @@ -46,6 +46,7 @@ Me.Button2 = Me.Factory.CreateRibbonButton Me.Tab1.SuspendLayout() Me.VERAG.SuspendLayout() + Me.SuspendLayout() ' 'Tab1 ' @@ -77,6 +78,7 @@ Me.Tab1.PerformLayout() Me.VERAG.ResumeLayout(False) Me.VERAG.PerformLayout() + Me.ResumeLayout(False) End Sub diff --git a/VERAGAddIn/Ribbon1.resx b/VERAGAddIn/rbnVERAG.resx similarity index 100% rename from VERAGAddIn/Ribbon1.resx rename to VERAGAddIn/rbnVERAG.resx diff --git a/VERAGAddIn/rbnVERAG.vb b/VERAGAddIn/rbnVERAG.vb new file mode 100644 index 0000000..a64f30e --- /dev/null +++ b/VERAGAddIn/rbnVERAG.vb @@ -0,0 +1,181 @@ +Option Explicit On + +Imports VERAG_PROG_ALLGEMEIN +Imports Microsoft.Office.Tools.Ribbon +Imports System.Windows.Forms +Imports Microsoft.Office.Interop +Imports VERAGAddIn.ThisAddIn +Imports System.Runtime.InteropServices + +Public Class VERAGRibbon + Dim LOGIN_OK = False + Public Shared Event bla() + Private Sub CustomerRibbon_Load(ByVal sender As System.Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonUIEventArgs) Handles MyBase.Load + + + End Sub + Private Function CreateRibbonDropDownItem() As RibbonDropDownItem + Return Me.Factory.CreateRibbonDropDownItem() + End Function + + Private Function CreateRibbonMenu() As RibbonMenu + Return Me.Factory.CreateRibbonMenu() + End Function + + Private Function CreateRibbonButton() As RibbonButton + Dim button As RibbonButton = Me.Factory.CreateRibbonButton() + ' AddHandler (button.Click), AddressOf Button_Click + Return button + End Function + + Private Sub Ribbon1_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load + + VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False + initFirmaUser() + End Sub + + Sub initFirmaUser() + Dim ADMIN As New cADMIN + Try + Dim WI = System.Security.Principal.WindowsIdentity.GetCurrent().Name + If WI.Contains("\") Then + Dim Split() = WI.Split("\") + If Split(0).Contains("VERAG-NCTS") Then VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "ATILLA" + If Split(0).Contains("VERAG") Then VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "VERAG" + If Split(0).Contains("IMEX") Then VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "IMEX" + + Dim UsernameTMP = ADMIN.getUstName_ByAD(Split(0), Split(1)) + + If UsernameTMP <> "" Then + LOGIN_OK = ADMIN.checkLogin(UsernameTMP, ADMIN.getPwdFromUsrname(UsernameTMP, VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA), VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA) + End If + End If + Catch ex As Exception + ' MsgBox(ex.Message & ex.StackTrace) + End Try + If Not LOGIN_OK Then + LOGIN_OK = ADMIN.checkLogin("MAIL_USER", "VERAG_MAIL_USER_2017", "VERAG") + End If + End Sub + + Private Sub Button1_Click(sender As Object, e As RibbonControlEventArgs) + 'MsgBox("HI") + ' Dim ThisAddIn As New ThisAddIn + Dim s As String = "" + 'Dim app = ThisAddIn.getapp() + ' ThisAddIn.PrintAPageFromEmail() + RaiseEvent bla() + + End Sub + + + + + Private Sub Button2_Click(sender As Object, e As RibbonControlEventArgs) Handles Button2.Click + If LOGIN_OK Then + ' For Each ft As Form In My.Application.OpenForms + 'If ft.GetType.ToString = "AVISO.frmEintragAviso" Then + 'ft.BringToFront() + ' Exit Sub + ' End If + ' Next + + Dim ATTACHMENTS_LIST As New List(Of String) + + Dim KundenNr = -1 + Dim EingangsDatum As Date = CDate("01.01.1990") + Try + Dim explorer As Outlook.Explorer = Globals.ThisAddIn.Application.ActiveExplorer + Dim selection As Outlook.Selection = explorer.Selection + If selection.Count > 0 Then + Dim selectedItem = selection(1) + Dim mailItem As Outlook.MailItem = selectedItem + If mailItem IsNot Nothing Then + EingangsDatum = mailItem.ReceivedTime + Dim senderMail = "" + If mailItem.SenderEmailType = "EX" Then + senderMail = (mailItem.Sender.GetExchangeUser.PrimarySmtpAddress) + Else + senderMail = (mailItem.SenderEmailAddress) + End If + + KundenNr = VERAG_PROG_ALLGEMEIN.cKundenKontakte.getKdNrFromMailAdress(senderMail, False) ' false, wenn mehrere Niederlassungen von Frimen im KdStamm vorhanden... falsche KdNr... + + End If + saveAttachment(mailItem, ATTACHMENTS_LIST) + End If + Catch ex As Exception + MsgBox(ex.Message) + End Try + + + VERAG_PROG_ALLGEMEIN.cGlobal.Aktive_ID = 0 + Dim mainForm As New AVISO.frmEintragAviso + If KundenNr > 0 Then + AddHandler mainForm.Shown, Sub() + mainForm.kdAvisierer.KdNr = KundenNr + End Sub + End If + If EingangsDatum > CDate("01.01.1990") Then + mainForm.EingangsDatum = EingangsDatum + End If + mainForm.TopMost = True + mainForm.StartFromOUTLOOK = True + mainForm.ShowDialog() + + + Try + If VERAG_PROG_ALLGEMEIN.cGlobal.Aktive_ID > 0 Then + For Each ATT In ATTACHMENTS_LIST + Dim fi As New IO.FileInfo(ATT) + Dim typ = "" + If AVISO.frmSendungAnhangImport.getFileTypeValid(typ, fi.Extension) Then + AVISO.frmSendungAnhangImport.saveToDS(VERAG_PROG_ALLGEMEIN.cGlobal.Aktive_ID, fi.Name, ATT, "", typ) + End If + Next + End If + Catch ex As Exception + MsgBox(ex.Message & ex.StackTrace) + End Try + Else + MsgBox("Fehler beim Login!") + End If + + End Sub + + Private Sub saveAttachment(mail As Outlook.MailItem, ByRef ATTACHMENTS_LIST As List(Of String)) + + Dim attachments As Outlook.Attachments = Nothing + + Try + attachments = mail.Attachments + For Each attachment As Outlook.Attachment In mail.Attachments + 'Next + 'For i As Integer = 1 To attachments.Count + ' Dim attachment As Outlook.Attachment = attachments.Item(i) + ' MsgBox(attachment.FileName) + Dim specialFolder = "OutlookAttach\Outlook_" & Now.ToString("ddMMyy_HHmmss") + While IO.Directory.Exists(specialFolder) + specialFolder = "OutlookAttach\Outlook_" & Now.ToString("ddMMyy_HHmmss") + End While + ' Dim io As New IO.FileInfo(attachment.PathName) + Dim TMP_PATH As String = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(attachment.FileName, " io.Extension", False, False, specialFolder) + attachment.SaveAsFile(TMP_PATH) + ATTACHMENTS_LIST.Add(TMP_PATH) + Marshal.ReleaseComObject(attachment) + Next + Catch ex As Exception + MsgBox(ex.Message, ex.StackTrace) + Finally + If attachments IsNot Nothing Then + Marshal.ReleaseComObject(attachments) + End If + If mail IsNot Nothing Then + Marshal.ReleaseComObject(mail) + End If + 'If currInspector IsNot Nothing Then + ' Marshal.ReleaseComObject(currInspector) + 'End If + End Try + End Sub +End Class