Add an existing task pane to a new mail message - Outlook

I have an Outlook taskbar that opens when I open Outlook, and I added this using this approach.

https://msdn.microsoft.com/en-us/library/aa942846.aspx

I show and hide the task pane using the example given here:

https://msdn.microsoft.com/en-us/library/bb608590.aspx

So this works with email when the user clicks the toggle button. However, I added another ribbon control to the Outlook New Mail box, and I would like the same taskbar to be available on the side of this window. I managed to create another ribbon control (designer) and added this new button, but when I switch it, it does not open the taskbar in a new mail message window. It only switches the existing taskbar window, available in the inbox.

Code for managing the feed of a new mail message:

Imports Microsoft.Office.Tools.Ribbon Imports Outlook = Microsoft.Office.Interop.Outlook Imports Microsoft.Office.Tools Public Class ComposeSidebarRibbon Private Sub ComposeSidebarRibbon_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load End Sub Private Sub SidebarToggleButton_Click(sender As Object, e As RibbonControlEventArgs) Handles SidebarToggleButton.Click Globals.ThisAddIn.TaskPane.Visible = TryCast(sender, Microsoft.Office.Tools.Ribbon.RibbonToggleButton).Checked End Sub End Class 

How can i do this?

+6
source share
1 answer

According to MSDN, you can add multiple feeds using different feed identifiers -

You can add multiple feeds to the project. If multiple feeds have a feed ID, override the CreateRibbonExtensibilityObject method in the ThisAddin class of your project to specify which feed to display at run time.

The function used for this will look like -

 Protected Overrides Function CreateRibbonExtensibilityObject() As _ Microsoft.Office.Core.IRibbonExtensibility If myCondition = True Then Return Globals.Factory.GetRibbonFactory().CreateRibbonManager _ (New Microsoft.Office.Tools.Ribbon.IRibbonExtension() _ {New Ribbon1()}) Else Return Globals.Factory.GetRibbonFactory().CreateRibbonManager _ (New Microsoft.Office.Tools.Ribbon.IRibbonExtension() _ {New Ribbon2()}) End If End Function 

See the MSDN link HERE

+2
source

Source: https://habr.com/ru/post/1014515/


All Articles