【问题标题】:which is the better way to create an object of Outlook MaiItem这是创建 Outlook MailItem 对象的更好方法
【发布时间】:2014-07-22 05:31:03
【问题描述】:

我找到了两种创建 Outlook mailItem 对象的方法

Outlook.MailItem oMsg = (Outlook.MailItem)Globals.ThisAddIn.Application.CreateItem(Outlook.OlItemType.olMailItem);

 Outlook.Application oApp = new Outlook.Application();
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);

这两种代码有什么区别,哪一种更好更安全?

【问题讨论】:

    标签: outlook outlook-addin createobject mailitem


    【解决方案1】:

    如果您的代码位于 COM 插件中,则第一个是唯一的方法 - 使用传递给插件的 Outlok.Application 对象,而不是创建新实例。 COM 插件是受信任的,并且 Outlok.Application 对象不受安全提示的影响。

    【讨论】:

      猜你喜欢
      • 2017-03-23
      • 1970-01-01
      • 2018-12-19
      • 1970-01-01
      • 1970-01-01
      • 2014-08-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多