我有一个功能区xml,它添加了一个按钮并具有某些功能。但是,我必须在Thisaddin_startup()中编写哪些C#行,以便在启动时使Outlook中的按钮可用?如果我运行该项目,我无法在Outlook Addin中看到任何按钮。
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)
{
}
答案 0 :(得分:1)
我在outlook addin的邮件标签中添加了一些按钮。您需要在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
}//
您无需创建Application实例。你可以访问它。应用程序。