0

I've created a html template with a couple of replacement variables.

Adding the created signature-template as signature for reply and new messages does not seem to get outlook to default to it.

//string signatureName = "Example.htm";

//Set via office-interop new signature as default
//using Microsoft.Office.Interop.Word;
Application app = new Application();
var opt = app.EmailOptions.EmailSignature;

opt.NewMessageSignature = signatureName;
opt.ReplyMessageSignature = signatureName;

app.Quit(); //Also tried WdSaveOptions.wdSaveChanges
Marshal.ReleaseComObject(app);

enter image description here

Outlook displays the added signature (TEST_...) but does not recognize it as default signature. Instead it just removed the previous default signature and now has none.

Is there something else required to tell outlook to set it as default ?

Blacktempel
  • 3,935
  • 3
  • 29
  • 53

2 Answers2

0

The Outlook object model doesn't provide anything for that. Of course, as a workaround you may use the Word object model for setting signatures as you did in the code above:

Application app = new Application();
var opt = app.EmailOptions.EmailSignature;

opt.NewMessageSignature = "Eugene Astafiev";
opt.ReplyMessageSignature = "E.Astafiev";

app.Quit(); //Also tried WdSaveOptions.wdSaveChanges
Marshal.ReleaseComObject(app);

But you need to assign a real HTML markup or text which represents the signature, not an HTML document filename.

Anyway, all settings are stored in the windows registry. See Set Default Signature outlook for more information.

Community
  • 1
  • 1
Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • `But you need to assign a real HTML markup or text which represents the signature, not an HTML document filename.` The [MSDN documentation](https://msdn.microsoft.com/en-us/library/office/ff841021.aspx) states that you have to use a name, not directly a signature. – Blacktempel May 11 '17 at 05:29
0

Apparently the problem was something... quite simple.

string signatureName = "Example.htm";

Outlook/Word expects the signature-name without the file-extension. Passing "Example" instead of "Example.htm" worked.

Blacktempel
  • 3,935
  • 3
  • 29
  • 53