Monitoring

This commit is contained in:
ms
2020-10-19 10:07:30 +02:00
parent 80d07c49dc
commit 1e911b3236
9 changed files with 231 additions and 20 deletions

View File

@@ -1,15 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
# Visual Studio Version 16
VisualStudioVersion = 16.0.30406.217
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VERAGAddIn", "VERAGAddIn\VERAGAddIn.vbproj", "{D579F7A6-7D29-4295-B382-DA5F7EFB4528}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VERAG_PROG_ALLGEMEIN", "..\..\SDL\SDL\VERAG_PROG_ALLGEMEIN\VERAG_PROG_ALLGEMEIN.vbproj", "{A3B497BD-842C-4A2B-B398-ED1976849DF1}"
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VERAG_PROG_ALLGEMEIN", "..\SDL\SDL\VERAG_PROG_ALLGEMEIN\VERAG_PROG_ALLGEMEIN.vbproj", "{A3B497BD-842C-4A2B-B398-ED1976849DF1}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Gemeinsames", "..\..\AVISO\Aviso\Gemeinsames\Gemeinsames.vbproj", "{110C923B-CB02-4FD0-AF24-95E0F0EEEFF5}"
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Gemeinsames", "..\AVISO\Aviso\Gemeinsames\Gemeinsames.vbproj", "{110C923B-CB02-4FD0-AF24-95E0F0EEEFF5}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Aviso", "..\..\AVISO\Aviso\Aviso\Aviso.vbproj", "{7BDD8C2F-2C9E-49F1-A365-3B1DA1C84991}"
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Aviso", "..\AVISO\Aviso\Aviso\Aviso.vbproj", "{7BDD8C2F-2C9E-49F1-A365-3B1DA1C84991}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -65,4 +65,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {45BA122D-A6FD-4A0F-B2B7-22921B1B1004}
EndGlobalSection
EndGlobal

View File

@@ -1,18 +1,32 @@
Option Explicit On
Imports Microsoft.Office.Interop
Imports System.Reflection
Imports System.Windows.Forms
Imports Microsoft.Office.Core
Imports Microsoft.Office.Tools.Ribbon
Imports System.Dynamic
'Option Private Module
'Imports Microsoft.Office.Core
Public Class ThisAddIn
Private WithEvents inspectors As Outlook.Inspectors
Private WithEvents Items As Outlook.Items
Private WithEvents currentExplorer As Outlook.Explorer
Public Shared WithEvents SharedExplorer As Outlook.Explorer
Public Shared WithEvents SelectedMail As Outlook.MailItem
Public Shared WithEvents MapiPath As Outlook.MAPIFolder
Public Shared MailOpened As Boolean = False
Public Shared WithEvents oufolder As Outlook.Folder
' Dim fldr As Outlook.Folder
'Dim mapifldr As Outlook.MAPIFolder
Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
inspectors = Me.Application.Inspectors
currentExplorer = Me.Application.ActiveExplorer
SharedExplorer = currentExplorer
AddHandler VERAGRibbon.bla, Sub()
' MsgBox("JOAS")
@@ -23,10 +37,117 @@ Public Class ThisAddIn
' MsgBox("JOAS")
' TestPrintFirstPage()
End Sub
End Sub
Private APP = Me.Application
Public Shared Sub Folder_BeforeItemMove(ByVal anItem As Object, ByVal aMoveToFolder As Outlook.MAPIFolder, ByRef Cancel As Boolean) Handles oufolder.BeforeItemMove
Dim mailItem As Outlook.MailItem = (TryCast(anItem, Outlook.MailItem))
MailChanged(Nothing, mailItem, "verschoben nach " & aMoveToFolder.FullFolderPath.ToString & " von: ")
End Sub
Private Sub CurrentExplorer_Event() Handles currentExplorer.SelectionChange
'Dim oldmailitem As Outlook.MailItem = SelectedMail
' mapifldr = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
Dim selectedFolder As Outlook.MAPIFolder = Me.Application.ActiveExplorer().CurrentFolder
Dim expMessage As String = "Your current folder is " & selectedFolder.Name & "." & vbLf
Dim itemMessage As String = "Item is unknown."
oufolder = CType(Application.GetNamespace("MAPI").GetFolderFromID(selectedFolder.EntryID), Outlook.Folder)
Try
If Me.Application.ActiveExplorer().Selection.Count > 0 Then
Dim selObject As Object = Me.Application.ActiveExplorer().Selection(1)
If TypeOf selObject Is Outlook.MailItem Then
Dim mailItem As Outlook.MailItem = (TryCast(selObject, Outlook.MailItem))
itemMessage = "The item is an e-mail message." & " The subject is " & mailItem.Subject & "."
If mailItem Is SelectedMail Then
Exit Sub
Else
MailOpened = False
End If
SelectedMail = mailItem
'mailItem.Display(False)
ElseIf TypeOf selObject Is Outlook.ContactItem Then
Dim contactItem As Outlook.ContactItem = (TryCast(selObject, Outlook.ContactItem))
itemMessage = "The item is a contact." & " The full name is " & contactItem.Subject & "."
'contactItem.Display(False)
ElseIf TypeOf selObject Is Outlook.AppointmentItem Then
Dim apptItem As Outlook.AppointmentItem = (TryCast(selObject, Outlook.AppointmentItem))
'itemMessage = "The item is an appointment." & " The subject is " & apptItem.Subject & "."
ElseIf TypeOf selObject Is Outlook.TaskItem Then
Dim taskItem As Outlook.TaskItem = (TryCast(selObject, Outlook.TaskItem))
'itemMessage = "The item is a task. The body is " & taskItem.Body & "."
ElseIf TypeOf selObject Is Outlook.MeetingItem Then
Dim meetingItem As Outlook.MeetingItem = (TryCast(selObject, Outlook.MeetingItem))
'itemMessage = "The item is a meeting item. " & "The subject is " & meetingItem.Subject & "."
End If
End If
expMessage = expMessage + itemMessage
Catch ex As Exception
expMessage = ex.Message
End Try
MapiPath = selectedFolder.Parent
End Sub
Public Shared Sub MailIsChanged(sender As System.Object) Handles SelectedMail.PropertyChange
'If MailOpened = False Then
MailChanged(sender)
'End If
End Sub
Public Shared Sub MailChanged(sender As System.Object, Optional ByRef Mail As Outlook.MailItem = Nothing, Optional ByVal Commenttext As String = "")
' If MailOpened = True And SendFromOpenMail = True Then RemoveHandler SelectedMail.PropertyChange, AddressOf MailChanged
'MsgBox(MailOpened)
Dim Changes As String = Date.Now.ToString & ": "
If Mail Is Nothing Then Mail = SelectedMail
If sender IsNot Nothing Then
Select Case sender.ToString
Case "Categories"
If Mail.Categories IsNot Nothing Then
Changes &= "Kategorie geändert auf " & Mail.Categories.ToString & " von: "
Else
Changes &= "Kategorie gelöscht von: "
End If
Case "UnRead"
If Mail.UnRead = True Then
Changes &= "Mail als ungelesen markiert von: "
Else
Changes &= "Mail als gelesen markiert von: "
End If
'Case "FlagStatus"
' MsgBox("FlagStatus")
Case Else
Exit Sub
End Select
Else
Changes &= Commenttext
End If
Changes &= " " & VERAG_PROG_ALLGEMEIN.cAllgemein.USRNAME
Mail.FormDescription.Comment &= Changes & vbCrLf
Mail.Save()
' MsgBox(Changes)
End Sub
Public Sub TestPrintFirstPage()
Dim Mail As Outlook.MailItem

View File

@@ -167,6 +167,9 @@
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="VERAG_PROG_ALLGEMEIN">
<HintPath>..\..\SDL\SDL\VERAG_PROG_ALLGEMEIN\bin\Debug\VERAG_PROG_ALLGEMEIN.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Office.Tools.v4.0.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
@@ -216,6 +219,7 @@
-->
<ItemGroup>
<AppDesigner Include="My Project\" />
<Compile Include="cMailItem.vb" />
<Compile Include="frmAvisoAnfügen.Designer.vb">
<DependentUpon>frmAvisoAnfügen.vb</DependentUpon>
</Compile>
@@ -319,18 +323,14 @@
</COMReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\AVISO\Aviso\Aviso\Aviso.vbproj">
<ProjectReference Include="..\..\AVISO\Aviso\Aviso\Aviso.vbproj">
<Project>{7bdd8c2f-2c9e-49f1-a365-3b1da1c84991}</Project>
<Name>Aviso</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\AVISO\Aviso\Gemeinsames\Gemeinsames.vbproj">
<ProjectReference Include="..\..\AVISO\Aviso\Gemeinsames\Gemeinsames.vbproj">
<Project>{110c923b-cb02-4fd0-af24-95e0f0eeeff5}</Project>
<Name>Gemeinsames</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\SDL\SDL\VERAG_PROG_ALLGEMEIN\VERAG_PROG_ALLGEMEIN.vbproj">
<Project>{a3b497bd-842c-4a2b-b398-ed1976849df1}</Project>
<Name>VERAG_PROG_ALLGEMEIN</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Resources\Aviso.png" />
@@ -377,7 +377,7 @@
</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>D08413FBDF065D4AB51DA9E7705AC1B0DA0041F2</ManifestCertificateThumbprint>
<ManifestCertificateThumbprint>443CA3745EE904EED98572A89099259301BA06D1</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
@@ -396,7 +396,7 @@
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{BAA0C2D2-18E2-41B9-852F-F413020CAA33}">
<ProjectProperties HostName="Outlook" HostPackage="{29A7B9D7-A7F1-4328-8EF0-6B2D1A56B2C1}" OfficeVersion="15.0" VstxVersion="4.0" ApplicationType="Outlook" Language="vb" TemplatesPath="" DebugInfoExeName="#Software\Microsoft\Office\15.0\Outlook\InstallRoot\Path#outlook.exe" AddItemTemplatesGuid="{5D898164-AEB5-470F-97BA-9253F022FD71}" />
<ProjectProperties HostName="Outlook" HostPackage="{29A7B9D7-A7F1-4328-8EF0-6B2D1A56B2C1}" OfficeVersion="15.0" VstxVersion="4.0" ApplicationType="Outlook" Language="vb" TemplatesPath="" DebugInfoExeName="#Software\Microsoft\Office\16.0\Outlook\InstallRoot\Path#outlook.exe" AddItemTemplatesGuid="{5D898164-AEB5-470F-97BA-9253F022FD71}" />
<Host Name="Outlook" PublishedHash="69C324AB27932AA2FBF2B7EA72250886FF164DE6" IconIndex="0">
<HostItem Name="ThisAddIn" Code="ThisAddIn.vb" CanonicalName="AddIn" PublishedHash="097D042D33F55A3A3980D4AB7E40C018B0D94DAF" CanActivate="false" IconIndex="1" Blueprint="ThisAddIn.Designer.xml" GeneratedCode="ThisAddIn.Designer.vb" />
</Host>

3
VERAGAddIn/cMailItem.vb Normal file
View File

@@ -0,0 +1,3 @@
Public Class cMailItem
End Class

View File

@@ -41,10 +41,14 @@
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.Tab1 = Me.Factory.CreateRibbonTab
Me.Group1 = Me.Factory.CreateRibbonGroup
Me.Button1 = Me.Factory.CreateRibbonButton
Me.Button2 = Me.Factory.CreateRibbonButton
Me.btnInfo = Me.Factory.CreateRibbonButton
Me.btnUnsichtbar = Me.Factory.CreateRibbonButton
Me.NotifyIcon1 = New System.Windows.Forms.NotifyIcon(Me.components)
Me.Tab1.SuspendLayout()
Me.Group1.SuspendLayout()
Me.SuspendLayout()
@@ -60,6 +64,8 @@
'
Me.Group1.Items.Add(Me.Button1)
Me.Group1.Items.Add(Me.Button2)
Me.Group1.Items.Add(Me.btnInfo)
Me.Group1.Items.Add(Me.btnUnsichtbar)
Me.Group1.Label = "AVISO"
Me.Group1.Name = "Group1"
'
@@ -79,6 +85,22 @@
Me.Button2.Name = "Button2"
Me.Button2.ShowImage = True
'
'btnInfo
'
Me.btnInfo.Label = "?"
Me.btnInfo.Name = "btnInfo"
'
'btnUnsichtbar
'
Me.btnUnsichtbar.Label = "i"
Me.btnUnsichtbar.Name = "btnUnsichtbar"
Me.btnUnsichtbar.Visible = False
'
'NotifyIcon1
'
Me.NotifyIcon1.Text = "NotifyIcon1"
Me.NotifyIcon1.Visible = True
'
'rbnMailItem
'
Me.Name = "rbnMailItem"
@@ -98,6 +120,9 @@
Friend WithEvents Group1 As Microsoft.Office.Tools.Ribbon.RibbonGroup
Friend WithEvents Button1 As Microsoft.Office.Tools.Ribbon.RibbonButton
Friend WithEvents Button2 As Microsoft.Office.Tools.Ribbon.RibbonButton
Friend WithEvents btnInfo As Microsoft.Office.Tools.Ribbon.RibbonButton
Friend WithEvents NotifyIcon1 As Windows.Forms.NotifyIcon
Friend WithEvents btnUnsichtbar As Microsoft.Office.Tools.Ribbon.RibbonButton
End Class
Partial Class ThisRibbonCollection

View File

@@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="NotifyIcon1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -1,12 +1,27 @@
Imports Microsoft.Office.Tools.Ribbon
Option Explicit On
Imports Microsoft.Office.Tools.Ribbon
Imports Microsoft.Office.Interop
Imports System.Windows.Forms
Public Class rbnMailItem
Dim LOGIN_OK As Boolean = False
Dim LoadInspector As Outlook.Inspector
Public Shared Event bla()
Public Shared WithEvents ThisMail As Outlook.MailItem
Dim currentexplorer As Outlook.Explorer
Private Sub rbnMailItem_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
LOGIN_OK = AVISO_Mail_Functions.initFirmaUser()
currentexplorer = ThisAddIn.SharedExplorer
Dim selObject As Object = currentexplorer.Selection(1)
ThisMail = (TryCast(selObject, Outlook.MailItem))
End Sub
Private Function CreateRibbonDropDownItem() As RibbonDropDownItem
Return Me.Factory.CreateRibbonDropDownItem()
End Function
@@ -37,4 +52,28 @@ Public Class rbnMailItem
End Try
End If
End Sub
Private Sub btnInfo_Click(sender As Object, e As RibbonControlEventArgs) Handles btnInfo.Click
' MsgBox(VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME)
Try
Dim INSPECTOR As Outlook.Inspector = e.Control.Context
MsgBox(INSPECTOR.CurrentItem.FormDescription.Comment)
Catch
MsgBox("Fehler beim Anzeigen der Mailinformationen.")
End Try
End Sub
Private Sub btnUnsichtbar_Click(sender As Object, e As RibbonControlEventArgs) Handles btnUnsichtbar.Click
LoadInspector = e.Control.Context
ThisMail = LoadInspector.CurrentItem
End Sub
Public Shared Sub MailChanged(sender As System.Object) Handles ThisMail.PropertyChange
If ThisAddIn.SelectedMail.ConversationIndex = ThisMail.ConversationIndex Then
Exit Sub
Else
ThisAddIn.MailChanged(sender, ThisMail)
End If
End Sub
End Class

View File

@@ -1,7 +1,7 @@
Partial Class VERAGRibbon
Inherits Microsoft.Office.Tools.Ribbon.RibbonBase
<System.Diagnostics.DebuggerNonUserCode()> _
<System.Diagnostics.DebuggerNonUserCode()>
Public Sub New(ByVal container As System.ComponentModel.IContainer)
MyClass.New()
@@ -12,7 +12,7 @@
End Sub
<System.Diagnostics.DebuggerNonUserCode()> _
<System.Diagnostics.DebuggerNonUserCode()>
Public Sub New()
MyBase.New(Globals.Factory.GetRibbonFactory())
@@ -22,7 +22,7 @@
End Sub
'Die Komponente überschreibt den Löschvorgang zum Bereinigen der Komponentenliste.
<System.Diagnostics.DebuggerNonUserCode()> _
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
@@ -39,7 +39,7 @@
'Hinweis: Die folgende Prozedur ist für den Komponenten-Designer erforderlich.
'Das Bearbeiten ist mit dem Komponenten-Designer möglich.
'Nehmen Sie keine Änderungen mit dem Code-Editor vor.
<System.Diagnostics.DebuggerStepThrough()> _
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.Tab1 = Me.Factory.CreateRibbonTab
Me.VERAG = Me.Factory.CreateRibbonGroup

View File

@@ -256,6 +256,23 @@ Public Class AVISO_Mail_Functions
End Try
End Sub
Shared Sub MovedMail()
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
MsgBox("Du bist hier angelangt!")
End If
End If
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
End Try
End Sub
Shared Function getFirmaFromToMail(ToMail As String)
If ToMail.Contains("@verag") Then Return "VERAG"