以编程方式设置Outlook 2013签名默认值?

问题描述 投票:5回答:2

是否可以以编程方式设置Outlook 2013默认签名设置?我们可以生成用户的签名确定,但是也希望将签名设置为默认显示在用户的电子邮件中:

在Outlook配置文件中,设置本身似乎隐藏在注册表中:

HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6677\00000002

Reg值:

  • New Signature
  • Reply-Forward Signature

...(具有二进制数据,可能编码HTML文件名/参考)。

不确定我是否可以使用Outlook对象模型来访问和设置设置?使用ClickOnce应用程序是否可以实现这一点?

outlook office-interop outlook-2013
2个回答
0
投票

我还没有清理代码,但这对我来说在Outlook 2013中设置签名。在python中(是的,我知道它的丑陋而不是PEP8)。

import _winreg
def set_default():

    try:
        #this makes it so users can't change it.
        outlook_2013_key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Office\15.0\Common\MailSettings", 0, _winreg.KEY_ALL_ACCESS)
        _winreg.SetValueEx(outlook_2013_key, "NewSignature", 0, _winreg.REG_SZ, "default" )
        _winreg.SetValueEx(outlook_2013_key, "ReplySignature", 0, _winreg.REG_SZ, "default" )

        # sets the sigs in outlook profile
        outlook_2013_base_key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Office\15.0\Outlook\Profiles", 0, _winreg.KEY_ALL_ACCESS)
        default_profile_2013_tup = _winreg.QueryValueEx(outlook_2013_base_key,'DefaultProfile')
        default_profile_2013 = default_profile_2013_tup[0]
        print default_profile_2013
        outlook_2013_profile_key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
                                                   "Software\\Microsoft\\Office\\15.0\\Outlook\\Profiles\\" + default_profile_2013 + "\\9375CFF0413111d3B88A00104B2A6676", 0, _winreg.KEY_ALL_ACCESS)
        for i in range(0, 10):
            try:
                outlook_2013_sub_key_name = _winreg.EnumKey(outlook_2013_profile_key,i)
                print outlook_2013_sub_key_name, "sub_key_name"
                outlook_2013_sub_key = _winreg.OpenKey(outlook_2013_profile_key, outlook_2013_sub_key_name, 0, _winreg.KEY_ALL_ACCESS)
                _winreg.SetValueEx(outlook_2013_sub_key, "New Signature", 0, _winreg.REG_SZ, "default" )
                _winreg.SetValueEx(outlook_2013_sub_key, "Reply-Forward Signature", 0, _winreg.REG_SZ, "default" )
            except:
                pass

    except:
        print('no 2013 found')

0
投票

Outlook签名在配置文件数据(存储在注册表中)中基于每个帐户设置。您可以在OutlookSpy中查看数据 - 单击IOlkAccountManager按钮并双击该帐户。

IOlkAccountManager只能在C ++或Delphi中访问。如果使用Redemption是一个选项(它可以从任何语言使用,包括VBA或.Net,我是它的作者),它暴露了RDOAccount.ReplySignatureNewMessageSignature属性。

© www.soinside.com 2019 - 2024. All rights reserved.