'How to programmatically (C#) create and add a default (HTML) signature in Outlook 2013?

Sorry for bothering you - but maybe somebody can help me here!?

We are creating an Outlook 2013 VSTO Add-In to manage Corporate Signatures centrally and publish them to every user as a default signature.

We already managed to create the appropriate HTML files and store them in the correct folder.

All the same, there is no problem at all to modify the appropriate Registry keys, e. g.

HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\General

where we set the value of the "Signatures" element to the folder name of the signature file(s)

HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\MailSettings

where we set the value of the "NewSignature" and "ReplySignature" elements to the name of the default signature file

HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676

where - within the appropriate user profile folder - we need to set the values of the "New Signature" and "Reply-Forward Signature" elements to the binary-converted name of the default signature file.

All these operations work perfectly fine and afterwards, we find the correct files in the appropriate folders and the correct entries in the Registry keys.

However, when creating the very first eMail after the Outlook and eMail Signature Add-In setup, users do NOT see the default signature!

Only as soon as they once open the "Signatures" dialog in the mail editor screen - and it is really enough to only open it; no need to click "OK" or so! - then they get the signature!

So my question is: is there any other Registry key or whatever that need(s) to be set so that the signature appears right away - without having to make users open the "Signatures" dialog!? Does anybody know what happens in the background of this dialog!?

What do I overlook!?

Thank you very much everyone - I truly hope you can help me here!

Best regards, Torsten



Solution 1:[1]

The "9375CFF0413111d3B88A00104B2A6676" part is profile and account specific (it is profile section uid). It will be different for different users, profiles, and different accounts within the same profile .

You can see the data in OutlookSpy (I am its author) - click IOlkAccountManager, double click on the account, New and reply signature names will be in properties 0x0016001F and 0x0017001F respectively.

These properties can be set using Extended MAPI (C++ or Delphi) on IOlkAccount interface. You can also set them using Redemption (I am also its author - any language) - RDOAccount object exposes NewMessageSignature and Reply properties as well as Fields[] (can be used to set any property).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1