OnRibbonBeforeLoad is not firing on Outlook Addin

Add-in Express™ Support Service
That's what is more important than anything else

OnRibbonBeforeLoad is not firing on Outlook Addin
 
Bart Vadala




Posts: 9
Joined: 2015-09-21
Hi,

We have Outlook Addin based on Add-in Express for .NET and we add context menu items on the right-click on email. It works fine for most of the cases, but recently we encountered a scenario where in the context menu is not added.

When we debugged it by adding more logs, we found that
OnRibbonBeforeLoad
event is not firing in that particular installation.

Wondering could there be any reason why this event is not fired? and any ideas how to go about checking the cause of it?

Thanks,
Posted 27 Sep, 2022 23:56:08 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Bart,

In what scenario do you see this issue? Does the add-in load in this scenario?

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 28 Sep, 2022 08:31:29 Top
Bart Vadala




Posts: 9
Joined: 2015-09-21
Hi Andrei,

The add-in is loaded successfully and performing well, exception for Context menu part which is not showing up so users can't perform the action through context menu.

Thanks,
Posted 28 Sep, 2022 21:52:29 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Bart,

What do I do to reproduce the issue?

Are you sure that the event doesn't fire?

Can it be that the settings of the ADXRibbonContextMenu component don't let the context menu show?

Does the add-in at https://www.add-in-express.com/creating-addins-blog/2015/04/15/creating-office-context-menu-addin/ adds a button to that context menu?

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Sep, 2022 11:01:22 Top
Bart Vadala




Posts: 9
Joined: 2015-09-21
Hi Andrei,

Yes the event doesn't fire for some reason. This is an issue with one of the client machines, so I don't have access to it. if I get a chance will try the Add-In.

But is there a chance the event is not firing for any reason? Does it depend on any outlook setting or registry setting?

Thanks,
Posted 03 Oct, 2022 18:18:42 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Bart,

If the add-in loads, there's no reason for this event not to fire. I suppose that you have some other issue.

Bart Vadala writes:
Yes the event doesn't fire for some reason.


How do you know? Do you have a log confirming the event doesn't fire?

Also, BeforeRibbonCreate and BeforeRibbonLoad fire in a sequence; see section How the Ribbon UI of your add-in is created; see the PDF file in the folder {Add-in Express}\Docs on your development PC.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 04 Oct, 2022 03:45:28 Top
Bart Vadala




Posts: 9
Joined: 2015-09-21
Hi Andrei,

We do have application logs show that event is not fired in that particular client machine. That's the reason we are trying to figure out any ideas why this could happen. When you say some other issue, is there anything specific to look at? or any logs which can be enabled to get more ideas?

Regarding trying about other events BeforeRibbonCreate and BeforeRibbonLoad, will try out when we get similar issue.

Thanks,
Posted 06 Oct, 2022 00:25:26 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Bart,

Bart Vadala writes:
We do have application logs show that event is not fired in that particular client machine. That's the reason we are trying to figure out any ideas why this could happen


Unlike other Office applications, Outlook has several Ribbons - you specify the Ribbon(s) in which you want your Ribbon controls to show in the Ribbons property of the corresponding Ribbon components. Say a given Ribbon component may create the corresponding Ribbon controls in these Ribbons: OutlookExplorer, OutlookMailCompose, OutlookReport, OutlookRSS etc. When you open a window with a given Ribbon *for the first time*, Office calls the IRibbonExtensibility.GetCustomUI method passing it a string identifying the Ribbon. Add-in Express implements this method so that the following sequence is executed:

- The ADXAddinModule.OnBeforeRibbonCreate event is fired. Typically this event is used to create/update/delete Ribbon components on the add-in module.
- Add-in Express scans Ribbon components on the add-in module and generates the Ribbon XML for the specified Ribbon.
- The ADXAddinModule.OnBeforeRibbonLoad event is fired; the Ribbon XML just generated is passed to the event handler. Typically this event is used to update the Ribbon XML.

That is, the OnBeforeRibbonLoad is not fired if it was already fired for a given Outlook window type (=for a given Ribbon).

Another possibility would be an exception occurring while the Ribbon XML is being generated. By default that exception would cause an exception form to show in this way:


internal void DoError(object sender, Exception e)
{
    ADXErrorEventArgs hArgs = new ADXErrorEventArgs(e);
    if (OnError != null) OnError(hArgs);
    if (!hArgs.Handled)
    {
        ADXExceptionManager.ShowDialog(this, sender, e, MessageBoxButtons.OK, DPIResources.mb_error_all_32_64, ADXExceptionManager.UserErrorDefaultButton.Default);
    }
}


As you can see, you could prevent that form from showing by handling the ADXAddinModule.OnError event and setting e.Handled to true. Do you get that exception?

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 06 Oct, 2022 05:10:39 Top
Bart Vadala




Posts: 9
Joined: 2015-09-21
Hi Andrei Smolin,

Thanks for the details, will try to check based on the information provided when the clients escalate this issue again and get back to you.

Thanks
Posted 07 Oct, 2022 01:05:16 Top