问题
I'm looking to create an AddIn for outlook which will invoke an Attach and Forward function from another 3rd party addIn when a mail item is added to a certain folder, however I'm not sure how to find this button in order to invoke it. the desired button is displayed on the inbox screen (when mail is selected bottom left) but not when a mail is opened (double click) is in a drop-down, here's the structure. Highlighted is the desired function.
How would I invoke this function for a specific mail item I found the Redemption Library which seems useful but not sure how fully to apply it. Invoke Ribbon button in Outlook 2013
This is what I have so far. See comments. (snippet from @Dmitry Streblechenko)
private void ExecuteAttachAndForward()
{
Redemption.SafeInspector sInspector = new Redemption.SafeInspector();
sInspector.Item = Application.ActiveInspector().CurrentItem;
Redemption.SafeRibbon Ribbon = sInspector.Ribbon;
string oldActiveTab = Ribbon.ActiveTab;
Ribbon.ActiveTab = "Home"; // is this the correct name of the tab?
Redemption.SafeRibbonControl Control = Ribbon.Controls.Item("Attach and Forward");
// how would I access the pdf sub function in the dropdown?
Control.Execute();
Ribbon.ActiveTab = oldActiveTab; //restore the active tab
}
回答1:
A hacky way: Invoke the Ribbon via Redemption and use SendKeys.SendWait("{DOWN}{ENTER}");
Actually this seems to work pretty well.
来源:https://stackoverflow.com/questions/31991107/invoke-3rd-party-outlook-addin-button-from-my-addin