【问题标题】:How to add VSTO Outlook addin in start up?如何在启动时添加 VSTO Outlook 插件?
【发布时间】:2018-01-08 21:12:26
【问题描述】:

我有一个功能区 xml,它添加了一个按钮并具有某些功能。但是我必须在 Thisaddin_startup() 中编写哪些 C# 行才能使按钮在启动时在 Outlook 中可用?如果我运行该项目,我将无法在 Outlook 插件中看到任何按钮。

 public partial class ThisAddIn
{
    EpicTest obj = new EpicTest();
    Outlook.Inspectors inspectors;
    Outlook.Application application = new Outlook.Application();

    private Outlook.Explorer explorer = null;

    private void ThisAddIn_Startup(object sender, EventArgs e)
    {


    }

    protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
    {
        return new EpicTest();
    }
    private void InternalStartup()
    {
        this.Startup += new System.EventHandler(ThisAddIn_Startup);
        this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
    }
    void timerDelay_Tick(object sender, EventArgs e)
    {
    }

【问题讨论】:

    标签: c# vsto outlook-addin


    【解决方案1】:

    我在 Outlook 插件的邮件选项卡中添加了一些按钮。您需要将以下代码放入 EpicTest.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" 
    onLoad="Ribbon_Load">
    

               label="Custom Addin">
          <button id="xxuususuxx" label="Setting" onAction="Setting_OnAction" size="large" imageMso="TableSharePointListsModifyColumnsAndSettings"/>
    
        </group>
      </tab>
    </tabs>
    

    在ThisAddIn中添加以下代码

      protected override Microsoft.Office.Core.IRibbonExtensibility 
       CreateRibbonExtensibilityObject()
       {
      return new EpicTest(); //ribbonitem is name of instance of ribbonclass 
      }
    

    在 EpicTest.cs 文件中

    public void Setting_OnAction(Office.IRibbonControl control)
        {
            //your custom code for when button is click such as messagebox etc
        }//
    

    您不需要创建应用程序的实例。你可以通过 this.Application 访问它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-10
      • 2022-11-04
      • 1970-01-01
      • 2021-12-28
      • 2016-02-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多