views:

98

answers:

0

I am trying to write an Outlook 2007 VBA script which will look at the currently opened mail item and be able to read the properties of and save off the digital signature of said mail item.

Now I realize that Outlook prevents access to encrypt/sign a new email programatically, but here I am focused on messages which have already been received.

Here is where I am at so far, just being able to use the MessageClass property to detect a signed email.

Thanks,

David

Function GetCurrentItem() As Object
    Dim objApp As Outlook.Application

    Set objApp = CreateObject("Outlook.Application")
    On Error Resume Next
    Select Case TypeName(objApp.ActiveWindow)
        Case "Explorer"
            Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
        Case "Inspector"
            Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
        Case Else
            ' anything else will result in an error, which is
            ' why we have the error handler above
    End Select

    Set objApp = Nothing
End Function

Sub DoExport()
    Set CurrentItem = GetCurrentItem()
    If CurrentItem.MessageClass = "IPM.Note.SMIME.MultipartSigned" Then
        MsgBox CurrentItem.MessageClass 
    End If
End Sub