none
outlook 2013 addin - How to determine if an email is signed

    Question

  • 0

    In my Outlook 2007 and 2010 addin I was able to determine if the sign button was up or down.  using the following code:

    signBtn = Item.GetInspector.CommandBars.FindControl(, SIGN, ,True)

    if (signBtn.State = Office.MsoButtonState.msoButtonUP) then.

    In Outlook 2013 the GetInspector.CommandBars returns nothing. I was thinking that is I could determine in the email is already signed I could accomplish what I needed to do without knowing the state of the button.

     

    Tuesday, February 26, 2013 5:23 PM

Answers

  • Outlook has an annoying habit of representing signed and encrypted messages as regular IPM.Note MailItem objects. Even if you read the MailItem.MAPIOBJECT property, Outlook will return a fake IMessage MAPI object .

    I don't think you can read any security related properties until you save the mesage (MailItem.Save), and even then, you will need to use Extended MAPI or Redemption.

     

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    • Marked as answer by _enigma Tuesday, February 26, 2013 6:40 PM
    Tuesday, February 26, 2013 5:49 PM

All replies

  • Outlook has an annoying habit of representing signed and encrypted messages as regular IPM.Note MailItem objects. Even if you read the MailItem.MAPIOBJECT property, Outlook will return a fake IMessage MAPI object .

    I don't think you can read any security related properties until you save the mesage (MailItem.Save), and even then, you will need to use Extended MAPI or Redemption.

     

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    • Marked as answer by _enigma Tuesday, February 26, 2013 6:40 PM
    Tuesday, February 26, 2013 5:49 PM
  • So I could download and install the developer version and if it works purchase the distributable version.  Are there any code sample examples of it's use.  Specifically examples of using redemption to determine if an email is signed or if the sign button is depressed.
    • Edited by _enigma Tuesday, February 26, 2013 7:12 PM
    Tuesday, February 26, 2013 6:40 PM
  • Yes, you can do that.

    As an experiment, can you try the following in OutlookSpy??

    1. Set the encryption options.

    2. Save the message

    3. Click IMessage button on the OutlookSpy toolbar. PR_MESSAGE_CLASS is IPM.Notee, right?

    4. Click IMAPISecureMessage on teh IMessage window, then GetBaseMessage.

    5. What is the value of PR_MESSAGE_CLASS?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Tuesday, February 26, 2013 8:20 PM
  • What I am trying to do is enforce that emails with an attachment or active link is signed before I allow it to be send.   If I have to save it first I am not sure that will work for my requirements.
    Tuesday, February 26, 2013 8:42 PM
  • I don't think there is a way around saving the message first - otherwise the changes are only visible to Outlook.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Tuesday, February 26, 2013 9:06 PM
  • I tried a small test to get familiar with redemption.  I pasted this small snippet I found on the internet  and I got the following error:

    Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.  I installed and registered Redemption. Here is the sample code:

    Public Sub handleSend(ByVal item As Object, ByRef cancel As Boolean) Handles Application.ItemSend
            Dim Session As Redemption.RDOSession
            Dim Mail As Redemption.RDOMail
            Session = CreateObject("Redemption.RDOSession")
            Session.Logon()

            Mail = Session.GetDefaultFolder(Redemption.rdoDefaultFolders.olFolderInbox)
            Mail.Recipients.Add("eaters@lunch.com")
            Mail.Subject = "Lunch anybody?"
            Mail.Body = "Please open the message and click on one of the buttons"
            ''to indicate your lunch preference"
            Mail.VotingOptions = "Chinese;Italian;Mexican;Don't care"
            Mail.Send()

        End Sub

    I got the error on the CreateObject

    Wednesday, February 27, 2013 6:48 PM