Outlook Object Model - Hooking to the Conversation Cleanup Feature - outlook

Outlook 2010 has a feature called Convesation Cleanup. This feature is implemented using the Conversation Header Outlook Object Model.
I would like to hook to this call and perform an action when triggered, yet I can't figure out how to catch it/hook on to it. Is anyone aware if this is possible? If its not, are you aware of any way around it? I have tried using outlook spy to view the event log when executing 'conversation cleanup' with no luck (nothing logged)... is there anyway of viewing deeper tracing of outlook events?

It turns out to be quite simple. The initial step is to obtain the idMso of the desired button to override. Microsoft provides a list of all the control ids for the Office suite however I found faster and more user friendly way of obtaining the idMso.
Office Button/File -> Options -> Customize Ribbon -> Hover mouse on
desired command - idMso is displayed in brackets
Once we have the desired ids, we edit the Ribbon.xml by adding a set of commands to override the onAction/Enable settings of the button. See example bellow;
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<commands>
<command idMso="IgnoreConversation" onAction ="FooRoutine" enabled="true"/>
</commands>
<ribbon>
</ribbon>
</customUI>
Last, we create the desired function on the Ribbon.vb which will be executed once the button is pressed.
I strongly suggest that you watch the 8 minute MSDN video where the steps above have been very well explained.

Related

VSTO Outlook 2016 using IRibbonExtensibility and dynamicMenu: Custom DropDown Menu does not open in certain cases

In our VSTO Outlook AddIn we have a DropDownMenu that does not open on the devices of two customers. Both use Outlook 2016 32-Bit. They have been reporting this for a few months now. Before they had not experienced this problem.
When the customers try to open it it looks like this:
The DropDownMenu is implemented using IRibbonExtensibility and dynamicMenu like this in ribbon id Microsoft.Outlook.Mail.Compose:
<?xml version="1.0" encoding="utf-8"?>
<customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab idMso="TabNewMailMessage">
<group insertBeforeMso="GroupClipboard"
id="MyGroup"
label="Simba"
getVisible="IsAdvancedOutlookItemVisible" >
<dynamicMenu id="MyMenu"
size="large"
imageMso="AttachFile"
getLabel="GetLabel"
getContent="GetMenuContent"
getEnabled="IsEnabled"
invalidateContentOnDrop="true"
/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
We can not reproduce it inhouse.
We have found out that the GetMenuContent method is not called in these cases.
An interesting thing is that one customer reported that it happens only on a certain monitor. If he opens Outlook on another monitor the DropDownMenu is shown.
Maybe a bug in Outlook or do you have an idea what could go wrong here?
Your ribbon XML looks good, I don't see anything strange here. Make sure that the GroupClipboard tab exists on the UI. Also you may check whether other callbacks are invoked by the Office and no exceptions were thrown there prior to the GetMenuContent callback.
Note, 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. Read more about that in the How to: Show Add-in user interface errors article.
Finally I found the reason for this behavior:
Actually as #Eugene guessed at the customer's system there is an exception thrown that is shown if outlook is configured to display the error messages. It told me that there is an illegal character in the xml content GetMenuContent() returned.
I ran into the pifall since I directly built up the xml string and did not use something like XDocument. So there were illegal characters in the xml like ampersand that were not escaped.
I could not find it earlier since the xml content was built up dynamically and only in rare cases customers had such illegal characters.

VSTO Outlook: Detect when any Outlook backstage view overlaps the explorer or inspector window

Well, every time I need to do things in my Outlook Add-in using VSTO I always get problems, limitations, restrictions, etc.....
Having said that... Now I am trying to detect when explorer or inspector window are not visible as the topmost.
For example, I have a custom task pane which I catch any visibility change through the correspondent VisibleChanged event. This event is triggered when its visibility changes from true to false or vice versa or when the custom task pane is closed for any reason. When the custom task pane is not visible I do some stuff.
The problem I have is the following:
If I am in the explorer or inspector window and I click on the Outlook "File" tab/menu, the current view changes and the explorer and inspector are not the topmost (they are not visible) and the worst, the custom task pane VisibleChanged event is triggered.... so in this use case I do not want to do those stuffs when custom task pane is not visible. How can I detect this particular use case? I mean when explorer or inspector window are not displayed as the topmost.
You need to use backstage UI customizations where you could specify callbacks for handling the backstage open and close operations. For example, the following backstage UI XML markup declares the callback for opening the backstage UI:
<?xml version="1.0" encoding="utf-8"?>
<!-- customUI is the root tag of all Fluent UI customizations. -->
<customUI xmlns="https://schemas.microsoft.com/office/2009/07/customui"
onLoad="OnLoad">
<!—The Backstage element defines the custom structure of the Backstage UI. -->
<backstage onShow="OnShow">
So, by getting the onShow callback invoked you will be aware when the task pane is overlapped with a backstage UI in Office applications. See Adding Custom Commands and Changing the Visibility of Controls in the Office 2010 Backstage View for more information.
The backstage UI is described in depth in the Introduction to the Office 2010 Backstage View for Developers article.
FYI The Outlook object model provides the Application.ActiveWindow method which returns an object representing the current Microsoft Outlook window on the desktop, either an Explorer or an Inspector object.

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.

How to show outlook add-in in the main pane instead of compose and read context

It's my first time developing add in for outlook, i'm tryng to do an add-in that interact with outlook calendar to find an appointment, but i can only show up the add-in when i create new appointment, is there any way to show it outside compose and read context? like viva insights do?
i found that this can be done with VSTO, but i need it to work also with web outlook and other os, if someone can help me to figure it out i will apreciate.
i tried to do it following the add-in doc
https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points
i can't find an extension point that fits my purpose.
Thank you
Add-ins are only valid in Mail/Calendar individual item context currently. Hence, if no item (email / event) is selected, addins do not show-up or work - it does not know in which context it is suppose to run.
If your scenario requires it to run without email/event context, we suggest you to file a feature request here: https://aka.ms/M365dev-suggestions

Deploying CRM solution

Using the crm 2011 sdk samples I've written a C# routine in Visual Studio to deactivate all active records in a custom entity. Now I'd like to wire this routine to a custom button on ribbon (figured that one out using RibbonDiffXml) However I'm unsure how to go about deploying. Am I creating a dll to register with the plugin registration tool? Any guidance would be appreciated!
As I see it, you have two options:
Rewrite your code to use the Organization Service from JavaScript. You can put the code completely inside the button this way. However, this requires manually constructing the SOAP calls to the API. The SDK has a walkthrough for this.
Include your code in a plugin, create a custom entity that you can register this plugin against, and create an instance of that entity from the JavaScript that will fire when clicking your ribbon button. This is detailed in an answer to a similar question.
Here are even more alternative solutions:
Create a workflow plugin and trigger that workflow (that runs async in the background). Triggered manually, on an event or from a javascript.
Create a javascript but use the REST API or even better, use the CrmRestKit to deal with the REST-part and keep your scripts clean and easy to read and maintain.
Create an ASP.NET page (or silverlight control) that displays a dialog that shows a progress bar while the process is running.

Resources