outlook

Get email address from outlook if I know the signature name


I know the signature htm file name & want to get the email address associated with it. I send messages to outlook programmatically in a .net VB winforms application.

I have searched the whole user folder including hidden files for a signature name I know exists without finding anything so can only assume that it exists within the outlook pst file. Does anyone know how to retrieve it please. My internet searches to date have not come up with anything helpful. The outlook version is office 2016 standalone installed on the machine and I ruse late binding to avoid version issues.


Solution

  • Signature names are stored on the per-account basis in the profile section. Note that the same signature can be used in multiple accounts. That information is not accessible directly through the Outlook object Model unless you drop down to the Extended MAPI level (C++ or Delphi) - Account object in OOM exposes IOlkAccount property, which returns a pointer to the IOlkAccount MAPI interface. Once you have it, you can call IOlkAccount::GetProp to request the signature properties. You can see the data in OutlookSpy (I am its author).
    If C++ or Delphi are not an option, Redemption (I am also its author) exposes RDOAccount object, which exposes ReplySignature and NewMessageSignature properties:

      set Session = CreateObject("Redemption.RDOSession")
      Session.MAPIOBJECT = Application.Session.MAPIOBJECT
      for each acc in Session.Accounts
        Debug.Print "account: " & acc.Name
        set newSignature = acc.NewMessageSignature
        If not (newSignature is Nothing) Then
          Debug.Print "    new mail signature: " & newSignature.Name
        End If
      next
    

    enter image description here