We have an add-in that is intended to be used when a user is remotely logged into a server. They open outlook, start a process with the add-in, then leave their session logged in but disconnect their session. The server is setup to never go to sleep and to leave the user logged in the entire time. As expected we can reconnect and outlook is still open and running just fine. Or at least that used to be the case...
We are using Redemption in the add-in to trigger a button on a 3rd party ribbon control as part of the process. This was working fine for months. It still works fine when using the app. However if you are disconnected from the RDP session or if you simply lock the screen with CTRL-ALT-Delete, it throws the following error when it tries to execute the control.
System.Runtime.InteropServices.COMException (0x80004005): Error in IAccessible.accDoDefaultAction: MAPI_E_CALL_FAILED at Redemption.ISafeRibbonControl.Execute()
Here is the code it is running through at that time:
Redemption.SafeExplorer sExplorer = new Redemption.SafeExplorer();
sExplorer.Item = Application.ActiveExplorer();
Redemption.SafeRibbon Ribbon = sExplorer.Ribbon;
Ribbon.ActiveTab = "RIBBONTABNAMEHERE";
ISafeRibbonControls Controls = Ribbon.Controls;
Redemption.SafeRibbonControl Control = Controls.Item("CONTROLNAMEHERE");
Control.Execute(); //<--HERE IS WHERE IT DIES
Marshal.ReleaseComObject(sExplorer.Item);
Marshal.ReleaseComObject(sExplorer);
Marshal.ReleaseComObject(Controls);
Marshal.ReleaseComObject(Control);
Marshal.ReleaseComObject(Ribbon);
I've tried a million things but I can't figure out why executing a control without the user connected even if they are logged in still no longer works. This worked for a long time!