我被要求實施一種解決方案,即工作人員必須爲新電子郵件指定安全級別(這些由交換服務器過濾)。我想要做的是在發送新郵件時,會出現一個對話框,其中包含安全級別的選項,即PERSONAL
,UNCLASSIFIED
,CLASSIFIED
等,然後附加到主題行[SEC=variable]
的後面。目前我有下面的代碼,但是這顯然必須手動修改,我不希望工作人員必須這樣做(他們不會)。VBA Outlook插件中的選項
Public Class ThisAddIn
Private WithEvents inspectors As Outlook.Inspectors
Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
inspectors = Me.Application.Inspectors
End Sub
Private Sub inspectors_NewInspector(ByVal Inspector As Microsoft.Office.Interop.Outlook.Inspector) Handles inspectors.NewInspector
Dim mailItem As Outlook.MailItem = TryCast(inspector.CurrentItem, Outlook.MailItem)
If Not (mailItem Is Nothing) Then
If mailItem.EntryID Is Nothing Then
mailItem.Subject = "[SEC=UNCLASSIFIED]"
End If
End If
End Sub
Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
End Sub
End Class
任何幫助讓這個對話框將不勝感激。我正在使用Visual Studio 2010和Outlook 2010.
對於初學者,您可以創建一個用戶窗體,在用包含這些值的組合框發送時加載/顯示。在該對話框關閉時,如果選擇了一個選項,將其附加到主題中('mailItem.Subject = mailItem.Subject&「[SEC = UNCLASSIFIED]」)。 – Gaffi