disable outlook VSTO plugin icon - outlook

I have requirement to disable outlook vsto plugin icon if user open email from saved location . its job is to select highlighted emails from outlook and saved to external crm . There is new requirement that if email is saved on disk and re opened again it still shows the outlook plugin incon , i have to disable the incon if email is opened from disk .
any idea how to achieve this . I user select any email from outlook it should be fine but if email is saved on disk outlook addin icon should be disabled.
Many thanks

As a rule, mail items opened from the disk don't have the EntryID property set. I'd suggest starting from the NewInspector event which is fired whenever a new inspector window is opened, either as a result of user action or through program code. So, you may check whether the EntryID exists and whether item is not composed one which means newly created in Outlook. The PR_MESSAGE_FLAGS property provides flags that can be used to identify whether it is read-only or composed item.
As for the Fluent UI, you need to use the IRibbonUI.Invalidate or IRibbonUI.InvalidateControl methods. You can customize the Ribbon UI by using callback procedures in COM add-ins. For each of the callbacks the add-in implements, the responses are cached. For example, if an add-in writer implements the getImage callback procedure for a button, the function is called once, the image loads, and then if the image needs to be updated, the cached image is used instead of recalling the procedure. This process remains in-place until the add-in signals that the cached values are invalid by using the Invalidate method, at which time, the callback procedure is again called and the return response is cached. The add-in can then force an immediate update of the UI by calling the Refresh method. The getVisible callback should be used for hiding and displaying the ribbon UI dynamically.
The Fluent UI (aka Ribbon UI) is described in-depth in the following series of articles:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

Related

Outlook Add-In Event "When a mail is opened"

i want to display a message to the user (as an infobar for example) as soon as the user opens the mail. In the 'supported events' list i could not find an appropiate eventlistener that fires when a mail is opened. Does this event even exist? If yes, what is the name? If no, how else could i possibly achieve this task? It is a priority that i display an infobar and not set a category or any workaround like that.
Thanks in advance
I tried finding an appropiate eventlistener but could not find it.
Outlook activates some types of add-ins if the message or appointment that the user is reading or composing satisfies the activation rules of the add-in. The user can then choose the add-in from the Outlook UI to start it for the current item.
To have Outlook activate an add-in for specific conditions, specify activation rules in the add-in manifest by using the Rule elements. Read more about possible rules and workflows in the Activation rules for contextual Outlook add-ins article.
Note, you can post or vote for an existing feature request on Tech Community where they are considered when the Office dev team goes through the planning process.

How to raise event from one VSTO outlook addin project and subscribe in another VSTO outlook addin Project

Can someone please please provide the link or code snippet to raise an event from the click of the oulook ribbion button and we are able to subscribe it from the another project on the click of another button and get the data passed in it.
You can't directly - ribbon control events are only passed to the addin that created the ribbon controls in question. You can of course call any external code (including through Addin.Object) from the addin processing the event.
You can handle clicks on the built-in controls on the ribbon. Read more about that in the Temporarily Repurpose Commands on the Office Fluent Ribbon article.
But for the custom ribbon UI you need to ask for any public interface which can be consumed by others, so instead of trying to repurpose controls you could directly call the method or function in the add-in.

VSTO CommandBarButton click modifier

I create a toolbar menu hierarchy in Outlook using VSTO, CommandBarPopup and CommandBarButton. I set a Click handler on the CommandBarButton's and everything works fine, but I would like to be able to do different things in the click handler depending on whether the user right-clicked on the menu, or shift-left-clicked or what not (for example, to include or not include the original message when automatically composing a template reply).
How do I detect which mouse button the user clicked with, or whether shift, alt, or ctrl keys were pressed when the user clicked?
In the event handler you can use the Keyboard.GetKeyStates method which gets the set of key states for the specified key.
// Uses the Keyboard.GetKeyStates to determine if a key is down.
// A bitwise AND operation is used in the comparison.
if ((Keyboard.GetKeyStates(Key.LeftShift) & KeyStates.Down) > 0)
{
// the left shift is pressed now
}
CommandBars were deprecated with Office 2010. You need to use the Fluent UI for creating a custom UI in the add-in. There are two main ways in VSTO to create a custom UI:
Walkthrough: Create a custom tab by using the Ribbon Designer
Walkthrough: Create a custom tab by using Ribbon XML
A context menu is customized using the Fluent UI as well. See Extending the User Interface in Outlook 2010 for more information.
The Fluent UI is described in depth in the following series of articles:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

Outlook Add-in Event On-open email

I've been trying to activate my add-in when the user open his email so I can analyze it. I found one example in on add-in from another company (Retruster). The issue I didn't found way to reproduce the action. Someone knows how to reproduce this event? Because I just found when sending a message.
The labels shown on the YouTube video are categories set on emails. They can be set on the Exchange server side when your message arrives without any add-in involved. Remember, add-in activation rules are described in the manifest file - it can be regex filters, known entities etc. Read more about them in the Activation rules for contextual Outlook add-ins article.
The add-in starts working when the user clicks on the ribbon button.

How to add an Outlook Add-In Button to the main Mail Overview

I'm trying to create an Outlook Add-In that will forward the selected mail message as an attachment when the button is pressed. Preferably this will work both for the Outlook Client, and Outlook Web Access. To do this, I need to add a button to the main UI in Outlook which shows the list of messages.
However, within the new Add-In format, I don't see an ExtensionPoint for Outlook that allows adding a button to the main mail UI.
https://learn.microsoft.com/en-us/office/dev/add-ins/reference/manifest/extensionpoint#extension-points-for-word-excel-powerpoint-and-onenote-add-in-commands
There are options for the MessageRead pane or the MessageCompose pane, but I don't see anything for the general overview.
However, the following New Feature complains that multiple mail items can't be selected with the add-in syntax, which seems to imply that a single mail item can be selected. If a single mail item can be selected, then that implies that there is a way to add a button to the overview mail page since that's the only place mail can be selected.
This makes me think it is possible to do this, but I'm not sure how.
Can someone please point me to how this might be done?
NOTE: I am NOT trying to create a COM plugin. That is the old format and I've noticed they're increasingly less reliable in Outlook 2016. I am trying to use the new format.
The MessageReadCommandSurface and MessageComposeCommandSurface extension points for Outlook applies to both the main Outlook window (the Explorer) and the item (Inspector) windows. The Explorer Ribbon buttons activate when an email is selected, so the buttons interact on the selected email. So you don't have to do anything if you've already defined those extension points.

Resources