I have a ribbon button that appears on tabNewMailMessage in Outlook's compose email form, this button toggles the visibility of a CustomTaskPane stuck to the side of the form.
In normal practice, everything works perfectly. But when the Compose Email form is invoked via 'Attach to email' or 'Save & Send' from other applications like MS Word or Adobe Reader, the button appears but no longer does anything.
I learned from MSDN that the NewInspector event apparently does not fire in the case of external invocation.
I have not been able to find any workarounds for this case, does anybody here know? :(
EDIT : Additionally, I have a Global class (not the hidden GlobalS class that Visual Studio creates) that contains some variables I use across the entire program. The Addin will not load anything contained in there at all either. It's hard to tell what actually does get loaded, if anyone has more information, holler back please!
EDIT Again : Tested putting string in ThisAddIn and printing it through a messageBox in toggleButton, didn't work. If anyone is confused, the ribbon button will not load if the click-event is impossible to execute, so it seems that externally invoked Compose forms skip all code in ThisAddIn and any class that isn't the ribbon itself.
I really need help figuring this out! :(
EDIT Yet Again : Here is what I've garnered so far, ThisAddIn startup events will not fire, no properties in external classes may be read from, but external methods like say ThisAddIn.SayHelloWorld() do work.
EDIT again! :
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
//MessageBox.Show(,"TEST");
try
{
inspectors = Globals.ThisAddIn.Application.Inspectors;
inspectors.NewInspector += new InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
foreach (Inspector insp in inspectors)
{
//insp.
Inspectors_NewInspector(insp);
}
}
catch (System.Exception ex)
{
List<string> lalala = new List<string>();
lalala.Add(ex.GetType().ToString());
lalala.Add(ex.Message);
lalala.Add(ex.StackTrace);
File.WriteAllLines(@"C:\outdebug",lalala.ToArray());
}
}
Again! :
void Inspectors_NewInspector(Inspector Inspect)
{
try
{
if (Inspect.CurrentItem is MailItem)
{
Global.mail = Inspect.CurrentItem;
Global.inspectorWrappersValue.Add(Inspect, new InspectorWrapper(Inspect, Global.mail));
//inspectorw
}
}
catch (System.Exception ex)
{
List<string> lalala = new List<string>();
lalala.Add(ex.GetType().ToString());
lalala.Add(ex.Message);
lalala.Add(ex.StackTrace);
lalala.Add(Global.SiteConnectionManager.ToString());
File.WriteAllText(@"C:\Users\cat\Desktop\outdebug.txt", string.Join("\n", lalala), Encoding.UTF8);
}
}