Determine which action has been selected on Outlook Add-in icon click - outlook-addin

I am implementing Action Commands on Outlook Add-in.
As you can see from the image below. my add-in gives you 3 options when you click on it and this choice will determine how the add-in will perform and what results you will get.
My problem is I am not sure how to pass the chosen tab value from manifest to my Add-in Application. I played with a bit and I think the value I need is under
event.source.id
I open my add-in regardless of the choice so I am using but I need pass the selected value for the future use.
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="messageComposeTaskPaneUrl" />
</Action>
Now question is how do I pass that id to the Add-in application.

You should be using a different Action node (link) for each of your Add-in Commands. Normally developers have a different URL for each TaskPane Add-in Command, or a different FunctionName for each UI-less Add-in Commands.) This is a better solution than trying to check the title.
If you still want to use the same URL for each of your Add-in commands, you could try embedding information as a query string in your resid definition, e.g.
<Resources>
<bt:Urls>
<bt:Url id="readTaskPaneUrl" DefaultValue="https://yourpage.html?mode=Reply"/>
..
</bt:Urls>
..
</Resources>
But it is recommended that you use unique URLs instead.

Related

Outlook Add-In Ribbon button that is always active

How to define Outlook Add-In manifest so that the Add-In Ribbon button is always active regardless of if an mail or calendar item is selected? Insights add-in provided by Microsoft is doing it somehow as it is always active, while the Report Message add-in button is only active when an item is selected.
The Rule element is mandatory, and there is no "wildcard" to always enable the Add-In via Rules at least, so there is probably some other way.
<Rule xsi:type="RuleCollection" Mode="Or">
<Rule xsi:type="ItemIs" ItemType="Message" FormType="Read"/>
</Rule>
Current manifest:
Currently the feature of enabling an add-in without selecting an item, you requested, is not a part of the product.
We track Outlook add-in feature requests on our user-voice page. Please add your request here with the label “Type: product feature request”.
Feature requests on user-voice are considered, when we go through our planning process.

VSTO Addin disable builtin outlook button on Appointment (Recurring)

I am developing an Outlook Addin (VSTO, C#). I created the Addin with the following steps in VS: New->Project , then
From all what I learned in the meantime I fear that this DOES NOT create a COM-AddIn. But all tutorials listed below refer to COM AddIns.
I am looking for a step by step tutorial of how I can disable the builtin OUtlook Button which converts an appointment into a recurring appointment.
I already read a lot about fluent ribbons, like here
Programmaticaly disable existing button in outlook compose window ribbon
https://learn.microsoft.com/de-de/office/vba/library-reference/concepts/overview-of-the-office-fluent-ribbon
But I am just no able to put this into action for my purpose:
1.) I implemented in my Addin Class
public partial class ThisAddIn : Office.IRibbonExtensibility
...
string Office.IRibbonExtensibility.GetCustomUI(string RibbonID)
{
throw new NotImplementedException();
}
I set the breakpoint on the Exception. But running the addin (in Debugger) never stopped at that point.
I tried what is mentioned here:
IRibbonExtensibility GetCustomUI not called
I added [ComVisible(true)] to the VSTO AddIn Class. Does not work either. I also made sure that the Addin is still loaded.
2.) I am not sure how I could that with Outlook. It says that Outlook has several xml files (one per inspector?)
3.) I am not sure whether I would be able to dynamically change the buttons. Athough the second tutorial talks about that, but i am not sure if callbacks are the right concept here, because my application activley wants to decide when a button should be active/inactive, so there is no waiting for a callback to happen?
I know that the links provided above contain step-by-step tutorials. But there are just too many open questions to these tutorials.
You have already found a complete guide on how to repurpose a ribbon button. Just use command tag with the getEnabled attribute defined in your ribbon XML markup. For example:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<commands>
<command idMso="Permissions" getEnabled="OnGetEnabled" />
</commands>
</customUI>
You can repurpose built-in ribbon controls, see Temporarily Repurpose Commands on the Office Fluent Ribbon for more information.
VSTO provides two ways of customizing the Fluent UI:
Walkthrough: Create a custom tab by using the Ribbon Designer
Walkthrough: Create a custom tab by using Ribbon XML
Unfortunately, the UI designer doesn't support all the features of the Fluent UI. So, you need to stick with a raw XML markup described in one of the articles mentioned above.

spreadsheetgear+how to display built in page setup dialog

I tried to select/display the builtin pagesetup dialog highlighting the pagesetup tab in 'spreadsheetgear workbook explorer' window. In the .exe provided by spreadsheetgear, it is shown but not in the sample code provided by them, can anyone from the expert group who uses the spreadsheetgear advice me how to select the specific tab in the workbook explorer of spreadsheetgear through code.
If you are trying to pre-select a particular "Page Setup" node for a particular worksheet in the TreeView of the Workbook Explorer dialog when you instantiate this dialog yourself, i.e., something like...
WorkbookExplorer explorerDialog = new WorkbookExplorer(workbookView.ActiveWorkbookSet);
//explorerDialog.SelectPageSetupNode(...); // This API doesn't exist.
explorerDialog.Show();
...then this is not possible, as there are no public APIs to do this.
The SpreadsheetGear2017ForWindows.exe application can do this because it has access to internal APIs to make such a selection. We do collect feature requests to expose public APIs to perform such tasks (I work for SpreadsheetGear), so I can add one for you, although I cannot comment on if or when such a feature would be added to our product.

Reload Office content Add-In from powerpoint #24

I have office web add-in added in my PowerPoint slides (multiple instances of add-in). Need some settings that will be common across all add-in instances. for that tried to use VSTO Add-In and save those in settings file of it.
Now the issue is how i can pass those settings to each content add-in instances so i can read those in each add-in instance.
OR
Is there a way where i can get handle of content add-in's context menu buttons 'Reload', so after any change from VSTO Add-In, can i just call 'Reload'. I can move settings in DB if needed.
Content Add-In Reload option
Appreciate any insights on this.
You need to store these externally. Settings are scoped to a single Add-in (technically to a single manifest id). From the documentation:
The settings created by using the methods of the Settings object are saved per add-in and per document. That is, they are available only to the add-in that created them, and only from the document in which they are saved.

Replacing Word's Open File Dialog in a COM Add-in

I'm writing a Word COM Add-in that replaces the Open & Save dialogs with my own.
For the save dialog, I'm handling the documentBeforeSave event from the application events. This works fine.
For the open dialog, there is no such event, so I'm currently handling the onClick of the Open... menu item, canceling the default handling. This works ok if the user indeed uses this menu item, but if the user presses CTRL-O in stead they still get the original dialog.
Is there a better way to hook into this dialog? And if there isn't, is there a way to elegantly handle this keypress, or should I resolve to keyboard hooks?
Note: The add-in should eventually work on Office 2003, 2007 and 2010, but using different code-paths on different targets is of course perfectly fine. I am interested in any solutions on any version.
In Word 2007+, this turns out to be incredibly simple to implement. Simply repurpose the FileOpen command through the ribbon XML
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<commands>
<command idMso="FileOpen" onAction="doOpen" />
</commands>
...
The doOpen method then has two parameters, the second being an in/out parameter allowing you to cancel the event.
For previous version of Office, I've never implemented a fully bulletproof solution.