c# - NetOffice Outlook 插件部署

标签 c# outlook netoffice

我正在使用 NetOffice 开发 Outlook 插件。这个插件在我的本地机器上工作时(不知何故神奇地)通过 Visual Studio 部署(如果我运行项目然后打开 Outlook,功能就在那里)。一切都很好,直到这里。但是,我需要将它部署到其他人的计算机(没有安装 VS),我真的很难找到如何做到这一点的方法。

我的插件是这样的:

[COMAddin(Constants.ProjectName, "Tool", 3)]
[Guid("B3F60319-1A11-4F3E-9C1B-3AE908D9CA86"), ProgId("Tool.OutlookIntegration")]
public class OutlookIntegration : COMAddin
{
    public OutlookIntegration()
    {
        this.OnStartupComplete += new OnStartupCompleteEventHandler(this.Integrate);

        _settings = new Settings();
    }

    /* Integrate creates a menu item which does what I need. */
}

项目类型是图书馆。现在,问题是我如何让它在别人的 PC 上运行?如果您碰巧知道一些教程或类似的东西,请告诉我。 Internet 上有关于开发 Outlook 插件的资源,但它们似乎与 NetOffice 不同。 NetOffice 本身有很好的开发文档,但没有用于部署的文档(至少我还没有找到)。

我也很乐意提供所需的任何其他详细信息。

最佳答案

为了让 Outlook 安装插件,您唯一要做的就是在注册表中添加一些记录

string runKey = "SOFTWARE\\Microsoft\\Office\\Outlook\\Addins";
RegistryKey startupKey = Registry.CurrentUser.OpenSubKey(runKey,  true);
if (startupKey != null)
{
  runKey="SOFTWARE\\Microsoft\\Office\\Outlook\\Addins\\yourAddinNameSpace.yourAddinClass";
  startupKey = Registry.CurrentUser.OpenSubKey(runKey, true);
  if (startupKey == null)
    startupKey = Registry.CurrentUser.CreateSubKey(runKey);
    startupKey.SetValue("Description", "yourAddinName", Microsoft.Win32.RegistryValueKind.String);
    startupKey.SetValue("FriendlyName", "yourAddinName", Microsoft.Win32.RegistryValueKind.String);
    startupKey.SetValue("LoadBehavior", 3, Microsoft.Win32.RegistryValueKind.DWord);
  }
}
else 
  Console.WriteLine("Outlook is not installed");

关于c# - NetOffice Outlook 插件部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31021104/

相关文章:

c# - 本地化文件无法有效地在 MVC ASP.NET Core 2.2 中呈现 Razor 页面

excel - 将字符串从 Excel 单元格粘贴到 Outlook 邮件时保留回车符

css - 并排表格在 Outlook 中不起作用

c# - 检测 xll 是否已永久安装或 xll 文件是否只是临时打开?

c# - 仅为屏幕上的范围获取范围坐标

c# - 如何使用 .NetOffice 库添加 header

c# - 如何在 C# 中更改字符串路径的扩展名?

c# - NUnit 3.0 TestCase const 自定义对象参数

c# - Mongodb最好的查询方式

php - 实现从 MS Outlook 到我们的 Web 应用程序的拖放功能