Outlook AddIn: Formulare einfügen für Vollmachten.
This commit is contained in:
@@ -32,7 +32,8 @@ Public Class VERAGRibbon
|
||||
|
||||
Private Sub Ribbon1_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load
|
||||
|
||||
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
|
||||
'VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
|
||||
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
|
||||
LOGIN_OK = AVISO_Mail_Functions.initFirmaUser()
|
||||
End Sub
|
||||
|
||||
@@ -74,7 +75,12 @@ Public Class VERAGRibbon
|
||||
If LOGIN_OK Then AVISO_Mail_Functions.addMailToAviso_Hauptfenster()
|
||||
End Sub
|
||||
|
||||
Private Sub btnVM_Click(sender As Object, e As RibbonControlEventArgs) Handles btnVM.Click
|
||||
' ToDo -> Logif für das Einfügen eines PDFs aus einer Mail in eine Vollmacht im Aviso.
|
||||
If LOGIN_OK Then AVISO_Mail_Functions.addMailToAviso_Vollmachten()
|
||||
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Public Class AVISO_Mail_Functions
|
||||
@@ -105,7 +111,7 @@ Public Class AVISO_Mail_Functions
|
||||
Return att
|
||||
|
||||
End Function
|
||||
Shared Sub addMailToAviso(mailItem As Outlook.MailItem)
|
||||
Shared Sub addMailToAviso(mailItem As Outlook.MailItem, Optional isFormular As Boolean = False)
|
||||
Try
|
||||
If mailItem IsNot Nothing Then
|
||||
' Remove special characters from the file name and make sure it is not longer than 100 characters
|
||||
@@ -127,7 +133,7 @@ Public Class AVISO_Mail_Functions
|
||||
End If
|
||||
End If
|
||||
Dim Bezeichnung = strFileName
|
||||
Dim AvisoId = getAvisoId(Bezeichnung, pdf_mail, SendungsId, Art, ATTACHMENTS_LIST) ')getAttachmentStringList(mailItem))
|
||||
Dim AvisoId = getAvisoId(Bezeichnung, pdf_mail, SendungsId, Art, ATTACHMENTS_LIST, isFormular) ')getAttachmentStringList(mailItem))
|
||||
If AvisoId < 0 Then Exit Sub
|
||||
|
||||
Dim BezAnhang = If(Bezeichnung <> strFileName, Bezeichnung, "") 'Wenn die Bezeichnung geändert wurde --> und wenn nur 1 Anhang, dann wird die Bezeichnung für den Anhang verwendet.
|
||||
@@ -572,7 +578,19 @@ Public Class AVISO_Mail_Functions
|
||||
End Sub
|
||||
|
||||
|
||||
Shared Function getAvisoId(ByRef Bezeichnung, ByRef pdf_mail, ByRef SendungsId, ByRef Art, ByRef Att) As Integer
|
||||
Shared Function getAvisoId(ByRef Bezeichnung, ByRef pdf_mail, ByRef SendungsId, ByRef Art, ByRef Att, ByVal isFormular) As Integer
|
||||
|
||||
If (isFormular = True) Then
|
||||
Dim frmAvisoFormularAnfuegen As New frmAvisoFormularAnfuegen(Bezeichnung)
|
||||
If frmAvisoFormularAnfuegen.ShowDialog = DialogResult.OK Then
|
||||
SendungsId = frmAvisoFormularAnfuegen.SendungsId
|
||||
Bezeichnung = frmAvisoFormularAnfuegen.Bezeichnung
|
||||
pdf_mail = frmAvisoFormularAnfuegen.PDF_MAIL
|
||||
|
||||
Return 1
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim frmAvisoAnfügen As New frmAvisoAnfuegen(Bezeichnung)
|
||||
frmAvisoAnfügen.ATT = Att
|
||||
If frmAvisoAnfügen.ShowDialog = DialogResult.OK Then
|
||||
@@ -583,11 +601,29 @@ Public Class AVISO_Mail_Functions
|
||||
Art = frmAvisoAnfügen.cboArt._value
|
||||
Att = frmAvisoAnfügen.ATT
|
||||
|
||||
|
||||
Return AvisoId
|
||||
End If
|
||||
Return -1
|
||||
End Function
|
||||
|
||||
|
||||
Shared Sub addMailToAviso_Vollmachten()
|
||||
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
|
||||
mailItem = DirectCast(mailItem, Outlook.MailItem)
|
||||
|
||||
addMailToAviso(mailItem, True)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user