VSTO Outlook: Place custom group in Outlook Simplified and Classic Ribbon - outlook

I have a custom group within the ribbon menu. In classic and simplified explorer view I want to place my group after groups and before find groups, I mean, between groups and find groups. See screenshots. How can I do this?
Classic view:
Simplified view:
I have tried below:
<ribbon>
<tabs>
<tab idMso="TabMail">
<group id="MyGroupHome"
insertBeforeMso="GroupFind"
But it does not work. How can I make my group always visible in all views classic and simplified and even in full screen or not full screen?
UPDATE:
Using insertBeforeMso="GroupContactFind" is working on full screen but when not in full screen (you click on minimize button of the window) then it is only working in classic view but not in simplified view. What's happening?
UPDATE 2:
If I left click on my group in the ribbon, then a context menu appear and there is an option that says "Pin to ribbon", If I select it, then my group is always visible in the ribbon, just what I want, but how to do it programmatically?

Most probably you get an error at runtime and Office hides your customizations automatically. For example, when there is no such MsoId on the ribbon UI you will not get custom UI displayed. So, to track such situations I always recommend enabling UI errors in the host application when developing add-ins.
By default, if a VSTO Add-in attempts to manipulate the Microsoft Office user interface (UI) and fails, no error message is displayed. However, you can configure Microsoft Office applications to display messages for errors that relate to the UI. You can use these messages to help determine why a custom ribbon does not appear, or why a ribbon appears but no controls appear.
To show VSTO Add-in user interface errors
Start the application.
Click the File tab.
Click Options.
In the categories pane, click Advanced.
In the details pane, select Show VSTO Add-in user interface errors, and then click OK.
For Outlook, the Show VSTO Add-in user interface errors checkbox is located in the Developer section of the details pane. For other applications, the checkbox is located in the General section of the details pane.

Related

VSTO Outlook: Outlook does not maintain the position of a custom button within the ribbon menu

I have a custom button that I place in the ribbon menu but what I observe is that sometimes the button is visible and sometimes not, it depends on the size of the explorer and compose windows. If you resize to a smaller size it is not visible and if you resize to a bigger size it is visible. It only happens in simplified view but not in classic. So in simplified view it seems Outlook decides which buttons are being shown and which not based on a criteria that I don't know, maybe on the space available in the ribbon menu which in turn depends on the size of the window?
Anyway, If I click on commands bar button ("..." three dots button) at the end of the ribbon menu and then from that menu I do a mouse right click on my button and select "Pin to ribbon" for it, then my button is always visible in the ribbon menu regardless of if the view is classic or simpified or even if window is resized to any size.
Is there any way programmatically to indicate Outlook to always show my button in the ribbon menu?
No, the Outlook extensibility model (nor the Fluent UI) doesn't provide anything for that. You may try using RegMon for Windows to track windows registry changes in case if Outlook keeps such preferences there.

Is it possible to launch the taskpane if certain conditions are met?

I want the user to press on a command button which will run an API. If the API returns results, I want this to launch the taskpane and then display the result of the API.
Is this possible?
If we speak about web add-ins the task pane is launched by the button click independently of API results. At runtime you may decided what to display on the task pane.
But if you mean a custom task pane as a part of COM add-in you can do whatever you like - hide, show and etc.
For web add-ins, launching a task pane after running some code/API is not possible today. We track Outlook add-in feature requests on our Tech Community Page. Please submit your request there and choose the appropriate label(s). Feature requests on Tech Community are considered, when we go through our planning process.
Here are two alternatives I would suggest considering to see if they can work for your scenario
adding a command with ExecuteFunction as an action https://learn.microsoft.com/en-us/office/dev/add-ins/reference/manifest/functionfile and launching a dialog (displayDialogAsync)
Or, run ExecuteFunction that adds notification message with an action link that user can click to open a taskpane https://learn.microsoft.com/en-us/javascript/api/outlook/office.notificationmessageaction?view=outlook-js-preview

Is TabDefault the only option for placing a group on ribbon?

After years of developing COM add-ins, I am now doing a outlook js add-in. So I am newbie to this enviroment.
I have a couple of questions regarding the ribbon architecture.
From what I have read, I believe the TabDefault is the only option for the ribbon group. I am trying to place my ribbon group at a specific location and emulate the COM add-in. For example, for my Outlook COM add-in I can place my options button that pops up a dialog on the TabMail ribbon before group GroupQuickSteps. Is the Outlook ribbon only limited to TabDefault?
I would like to design my ribbon to have one button on the compose ribbon and one button on the read (pop-out) button. Then I would have two buttons on the main ribbon (TabMail). All buttons would perform different functions. Can I define separate logic for each ribbon/window? The only example I see is that Contoso sample app. Kind of confused about the manifest and limitations. Looks like that example pops up on all windows.
Any help is appreciated.
Thanks,
Tom
Web add-ins don't support ribbon customizations you could do with a COM add-in. But web add-ins provide the ability to create ribbon commands. You can read more about them in the Add-in commands for Outlook article.
Add-in commands are supported for four scenarios:
Reading a message
When the user is reading a message in the reading pane or in the Message tab for a pop-out read form, add-in commands added to the default tab appear on the Home tab.
Composing a message
When the user is composing a message, add-in commands added to the default tab appear on the Message tab.
Creating or viewing an appointment or meeting as the organizer
When creating or viewing an appointment or meeting as the organizer, add-in commands added to the default tab appear on the Meeting, Meeting Occurrence, Meeting Series, or Appointment tabs on pop-out forms. However, if the user selects an item in the calendar but doesn't open the pop-out, the add-in's ribbon group won't be visible in the ribbon.
Viewing a meeting as an attendee
When viewing a meeting as an attendee, add-in commands added to the default tab appear on the Meeting, Meeting Occurrence, or Meeting Series tabs on pop-out forms. However, if a user selects an item in the calendar but doesn't open the pop-out, the add-in's ribbon group won't be visible in the ribbon
Using a module extension
When using a module extension, add-in commands appear on the extension's custom tab.

Outlook Add-in: Pinnable Taskpane does not refresh view In Outlook

we have implemented the Pinnable Taskpane by following the article below.
https://learn.microsoft.com/en-us/outlook/add-ins/pinnable-taskpane
This works well in Outlook and OWA both.
Issue: We have 4 Ribbon command button for our Outlook add-in in Read view. We activate the Add-In with one of the button, lets say button A. Once the add-in is activated it shows the functionality from button A. We then pin the taskpane and move around the different messages. while navigating through certain special messages, app view changes and shows the data from the message. This is expected behavior. Once this view is loaded, we can not reset to original view by clicking the button A again on the Ribbon. However if we click button B, it eventually opens up another Task pane instance on top of previously pinned one and navigates to functionality B. The only way it can be reset is to unpin and restart the add-in.
This does not happen in OWA and only specific to Outlook. I ran a test on Outlook 2016 build 9126.2282.
Could someone point out if this is a known issue?

CustomTaskPane Visibility in Outlook

I have a custom TaskPane in Outlook. When the user toggles the visibility, I record it in the settings object so that the next time Outlook starts it will be shown/hidden as the user left it.
CustomTaskPane.VisibleChanged is raised in each of the following scenarios
The user clicks the X in the top right corner of the task pane
TaskPane.Visible is set in response to the user pressing a toggle button in the ribbon
The user presses the File menu button on the top left
The first two ways, the user clearly meant to hide the task pane. The third way the user was just trying to go to the menu screen (perhaps on their way to hit the Exit button).
Question
Is there anyway to determine that the event was raised because of the File Menu? Any way to programatically determine if the File Menu is currently open?
Here's what I mean by the File Menu Screen:
The Backstage UI provides two callbacks that can be used for tracking when the File menu is open and closed:
onShow - The Backstage view is displayed which triggers the OnShow callback procedure.
onHide - when the Backstage view is not longer visible.
The onShow attribute and the onHide attribute of the element can point to code that performs that kind of action.
<backstage onShow="OnShow">
See Customizing the Office 2010 Backstage View for Developers for more information.

Resources