[英]How to add VSTO Outlook addin in start up?
I have a ribbon xml which adds a button and have certain functionality. 我有一个功能区xml,它添加了一个按钮并具有某些功能。 But what C# lines I have to write in Thisaddin_startup() to make the button available in Outlook while starting up? 但是,我必须在Thisaddin_startup()中编写哪些C#行才能使按钮在启动时在Outlook中可用? If I run the project I am not able to see any buttons in Outlook Addin. 如果我运行该项目,则无法在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)
{
}
I am adding some button in mail Tab in outlook addin. 我在Outlook加载项的“邮件”选项卡中添加了一些按钮。 You need to put following code in EpicTest.xml 您需要将以下代码放入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>
Add following code in ThisAddIn 在ThisAddIn中添加以下代码
protected override Microsoft.Office.Core.IRibbonExtensibility
CreateRibbonExtensibilityObject()
{
return new EpicTest(); //ribbonitem is name of instance of ribbonclass
}
in EpicTest.cs file 在EpicTest.cs文件中
public void Setting_OnAction(Office.IRibbonControl control)
{
//your custom code for when button is click such as messagebox etc
}//
You do not need to create instance of Application. 您无需创建应用程序实例。 You can access it this.Application . 您可以访问this.Application。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.