Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Default Signature outlook

Tags:

c#

outlook

i made something to generate the signatures for users, but now i would also like to set it as default signature. this will it will be automaticly added to new emails you are writing or answering.

i have not been able to find any kind of example or reference to how i could do this. Can someone point me in the right direction please.

like image 881
Kage Avatar asked Jun 07 '12 10:06

Kage


2 Answers

I find it more easy to set the signatures through the VSTO Word object:

 static void SetDefault(string signature)
    {
        Word.Application oWord = new Word.Application();
        Word.EmailOptions oOptions;
        oOptions = oWord.Application.EmailOptions;
        oOptions.EmailSignature.NewMessageSignature = signature;
        oOptions.EmailSignature.ReplyMessageSignature = signature;
        //Release Word
        if (oOptions != null) System.Runtime.InteropServices.Marshal.ReleaseComObject(oOptions);
        if (oWord != null) System.Runtime.InteropServices.Marshal.ReleaseComObject(oWord);


    }
like image 147
MortenF Avatar answered Oct 19 '22 22:10

MortenF


Found a way to do this with a registry key. the key is located at HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows messaging Subsystem\Profiles[OutlookProfilename]\9375CFF0413111d3B88A00104B2A6676

in that key there will me mutitple folder 00000001 going up, for each signature one. if you delete someone's windows profile the count starts at 1 again.

in here if you place a REG_Binary named "New Signature" or "Reply-Forward Signature" the value should be the name of the signature in hex format. Say the signatures name is Test it would become
54 65 73 74 in hex. the reg key would like it like this:
54006500730074000000000000000000000000

i hope i made myself clear like this :D it wasnt easy finding this :D

like image 34
Kage Avatar answered Oct 19 '22 20:10

Kage