Accessing Outlook COM addins - vb.net

I am a novice at programming and it is my first time trying to program a plugin for outlook, which I am having issues with.
When using Application.COMAddIn("addinname").Update I get the error that COMaddin is not a member for Application. Reading Microsoft documentation seems to state that it is a member of Application.
I'm guessing this is a stupid mistake, any help will be greatly appreciated.

It is Application.COMAddIns (plural). But COMAddin object does not expose the Update method.
To see Outlook objects and their methods and properties, use OutlookSpy (I am its author) - in your particular case, click Application button on the OutlookSpy ribbon, select COMAddins property, click Browse. In the COMAddins window, go to the IEnumVariant tab and double click on an addin.

Related

Which RibbonType will show my custom Ribbon for a sent message in Outlook (2013) VSTO Add-In?

New here so please forgive any faux pas!
I have an Outlook VSTO Add-in with a custom ribbon which I currently display only on composing a new message or replying to a message.
I've selected Microsoft.Outlook.Mail.Compose and Microsoft.Outlook.Mail.Read in RibbonType, and my ribbon appears fine on creating a new message or replying, but not when I go to Sent and open a message.
Can anyone point me in the right direction as to where I can find a list of the RibbonTypes and what they relate to, or offer any advice?
Thanks!
Most probably you get a Fluent UI error.
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. See How to: Show Add-in user interface errors for more information.
You could use any idMso value which exists on the compose window and doesn't exist on the read inspector.

How to access "message bar" in Outlook?

When I enable "Out Of Office" automatic messages in Outlook 2010, the "message bar" is filled in with a warning text. I would like to use such a feature to inform the user of my own feature being enabled.
I cannot find any reference to programmatic access to this bar. I found something about the statusbar, but it is not usable in VBA in Outlook.
I am not even sure the proper English name of this feature is "message bar"; I am referring to the same bar which in Word is used to inform user that a document is "dangerous" because coming from internet.
Is this message bar exposed in VBA for Outlook?
I tried finding other methods to inform the user, so I started studying the Ribbon: if I could make my own tab visible I could use it as a "message bar", but Ribbon is managed by Outlook differently from other Office programs, so most of examples available around are not applicable/working in Outlook.
I was able to programmatically create a tab and add a button to it, but then I can't make the tab visible.
I also tried using property "position" of the commandbar: not just msoBarTop but also msoBarBottom or msoBarPopup, but Outlook ignores my efforts.
But maybe managing the Ribbon in Outlook with VBA should be addressed in a separate question (there are some questions about it here, but I could not find useful tips for me; I have no access to VB VSTO).
The area you are referring to is used to implement Mail Tips. Although you can create custom ones through the Exchange Admin Center , they cannot be interacted with via code.
Manipulating Ribbon controls to show states or user messages is not really recommended, as the Ribbon is generally a static thing (except in case of menus, dropdowns and Galleries).
If your goal is to show a transient alert, a better approach would be to use the Windows SDK to show Windows notifications. If having your alert hosted in Outlook is of the utmost importance, then look into using Form Regions or an add-in with Task Panes to display your messaging. Or even a simple VBA MessageBox or User Form.
Also note that your usage of the CommandBar is really only applicable to Outlook 2007 and earlier - there are no more CommandBars in newer versions, just the Ribbon.

Communicating with Outlook 2013 add-in (Skype for Business)

I have a task involving Outlook 2013 and the Skype for Business add-in (formerly known as Lync).
The add-in has a button which changes an appointment into a "Skype meeting".
Pic of button
Upon clicking this button, the following is added to the email body.Pic of default text
My goal is to change this default text (it isn't editable anywhere else). The way I planned to do this is by creating a macro to call the same function which the "Skype Meeting" button does, and then edit the body of the message after the default meeting text has been placed.
I checked for the "name" of the button via the 'Customize the ribbon' window, and within the 'Skype Meeting' group the 3 buttons had the same description (Macro: OnUCAppointmentOnAction)
Using VBA's object explorer I found the details of the method OnUCAppointmentOnAction:
Sub OnUCAppointmentOnAction(asIRibbonControlPtr As Object)
Member of UCAddinLib.UCAddinCallbackInterface
method OnUCAppointmentOnAction
I have added the library reference within VBA to UCaddin.dll (it's called Office Communicator W14 Type Library), yet when I try to call the macro OnUCAppointmentOnAction I get the error "Sub or Function not defined"
Where am I going wrong? Is there is a better way?
Don't do that. That method is implemented by the COM object implementing the IDTExtensibility2 interface that Outlook creates on startup when it loads the addin. In theory, you can do the same, but nobody known what will happen if there are two instances of the addin object instantiated. Simulate a click on the button, then edit the appointment body.

Word Add-in - find if dialog has focus?

I am writing a word add-in in VB .NET (using Add-in Express, but I don't think that's relevant).
I have created shortcuts, but I only want them to take effect if the document itself is in focus, not a dialog - for example, "Find and replace" or any other.
How do I determine if a dialog has focus?
The "Selection" property of the application points to the selection in the document, even if a dialog is currently selected. I can't find any "HasFocus"-equivalent property anywhere either. I'm running out of ideas :o)
Thanks!
This workaround worked for me:
My add-in keeps a reference to the handle of the most recently activated Word window, by using the GetActiveWindow API during the WindowActivate event of the Word application. This is necessary since, up until Office 2013, the Window object does not expose a handle property.
When a shortcut is triggered, I compare that to the handle of the currently active window, using the same API. If they don't match, I simply don't proceed :o)

VSTO C# expose ribbon events to other document level components

I have an a custom Excel Workbook using C# and VSTO.
Is there anyway for a worksheet to reference the ribbon and subscribe to events, or manipulate controls in the ribbon?
I haven't been able to find the syntax in Globals.Ribbons that will give me a handle to the ribbon.
I've been working on this same problem. So far, no luck. I'll be watching this thread! The ribbon XML API seems to be how Office abstracts the ribbon and keeps you from having any direct access.