且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从我的外接程序调用第三方的Outlook外接程序键式

更新时间:2023-02-13 10:13:33

哈克方式:通过赎回调用丝带和使用的的SendKeys .SendWait({下} {} ENTER);



其实这似乎工作得很好。


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                          
}

A hacky way: Invoke the Ribbon via Redemption and use SendKeys.SendWait("{DOWN}{ENTER}");

Actually this seems to work pretty well.