List Custom Button IDs in Outlook 2010 Inspector Ribbon - outlook-addin

I have an inspector in Outlook 2010 that contains a button that was placed in the Show group in the ribbon. The inspector current item is an appointment item. The form that this button originally belonged to no longer exists but, the button remains in the Show group and there is no documentation on this button. Is there a way to list all of the buttons by ID that are in the current ribbon? I'm looking to find the ID of this button so I can set enabled to false in my XML but, have had no luck thus far.
EDIT: To be a little more precise, I'm looking to loop through all of the elements in the ribbon in Outlook so I can find the correct ID of a button I want to remove from it. I'm using C#, .NET 4.0 and VSTO for the add-in.

Answering this myself in case anyone needs it.
You can use HideFormPage("Button Name") to hide the orphaned button placed in the ribbon by a custom form. There is no need to loop through the ribbon and find it.
Application.ActiveInspector.HideFormPage("Button Name");

Related

Purge an IMAP folder in Outlook 2016 using VBA

In Outlook 2016 I have connected an IMAP folder. Outlook is configured to mark items as deleted in IMAP folders. This is necessary because I want to process those items, that are marked for deletion seperately. After my macro is completed, that IMAP folder should be purged automatically.
In Outlook there is the ribbon "Folder" with the group "purge". In there is the menu "delete" with an menu item to purge the current folder. I can't find a way to execute the function from a VBA macro.
For Outlook 2010 there is this solution:
http://www.vboffice.net/en/developers/purge-deleted-imap-messages/
In Outlook 2016, the findControl method does not find the required control.
Is there any way to purge that folder?
Best solution would be some kind of API function.
Second best would be to simulate a click event on the control of the ribbon. "CommandBars" seems to contain some sort of context menus but not the ribbon controls.
Is it possible to define custom commandbars with standard controls in it? The control id seams to be still "12771".
I very briefly looked into the UI Automation toolkit but have found no good example of how to access the ribbon of a specific application.
Alternatively: can I get access to controls of the quick access toolbar? Adding the correct purge folder control to the quick access toolbar would rely on the user to click on that button at the right moment.
For buttons you can add to a ribbon or the QAT, the idMso can be seen at the end of the text when hovering over the command.
Sub PurgeFolder_Button_idMso()
' For buttons you can add to a ribbon or the QAT,
' the idMso can be seen at the end of the text when hovering over the command.
ActiveExplorer.CommandBars.ExecuteMso ("PurgeFolder")
End Sub

Unable to add button to Custom List Item Ribbon

I am trying to add a Print Item button to the Forms (New, Edit, Display) of items in a Custom List. In order to achieve this I am using the following microsoft article https://learn.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/hh500259(v%3Doffice.14).
I follow the steps, however the Button is not displayed. Attaching Screenshots of how it is set on Sharepoint designer as reference
Do you have any ideas of what can be happening? Is there another way to add a print button the the Items Ribbon?
The button would not be added to the Items ribbon. In fact, the button is added to the drop down menu of the list item, as the below picture shows:

Add Custom Button in Attach Items Outlook Addin

I need to Add a Custom Button on Click of Attach Items in Outlook Email. Please share the code or share the link to achieve the same.
Image
I don't think you can do that, Also note that in latest versions of Outlook there is no such dropdown - there are separate buttons.

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)

How do I get the item I right-clicked on in an addin for Outlook 2003?

I've got a great MS Outlook 2003 addin going that adds some features to the context menu. What I am lacking is the ability to get the item I've right-clicked on.
So, in .NET (I'm writing in VB.NET but I know C# as well), how would I grab the item I've right-clicked on? I only want to show this particular context menu addition when I'm right-clicking on an email item, and then do something with that item.
I've already got the menu added and the event firing when I click on my custom buttons, I just need to know how to get the object that is under the cursor in addition to the work I do when clicked.
Thanks for your help.
Try this (using C#):
foreach (MailItem mail in Application.ActiveExplorer().Selection)
{
// ...
}