Outlook : Add-in Position to preview panel - outlook-addin

I am working on add Office CustomTaskPane to my outlook. My target is to set this Pane at bottom of my mail preview. I am able to set at bottom but it show entire bottom body of outlook instead only to Reading Pane (email preview).
My code as below:
Private CTP As Office.CustomTaskPane
CTP = m_CTP.CreateCTP(CTP_PROGID, CTP_TITLE, objExplWrap.Explorer) 'm_olExplorer
'CTP.DockPositionRestrict = Microsoft.Office.Core.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange
CTP.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionBottom
CTP.Visible = False
What it show:
What I have to show (Requirement):

Related

Positioning of a menu item image (hbmpItem of a MENUITEMINFO) in a context menu

I am inserting a menu item into an Outlook Context menu for a subject text control. Here you can find a previous question I had on doing this.
The issue I have is that the image of the menu item is positioned strangely in Outlook 2010. In Outlook 2007 it is positioned differently. It seems that the menu item is holding the position for the checked image free in Outlook 2010.
This shows how my menu item looks with the below code. Notice the large space to the left of the image.
This shows how it looks when i add the MIIM_CHECKMARKS flag to fMask and a bitmap to the hbmpUnchecked pointer.
Dim bmp As Drawing.Bitmap = My.Resources.olContextMenuIcon
bmp.MakeTransparent(bmp.GetPixel(10, 10))
hbitmap = bmp.GetHbitmap
Dim mii As New NativeMethodsEX.MENUITEMINFO
With mii
.cbSize = Marshal.SizeOf(mii)
.fMask = NativeMethodsEX.MIIM.MIIM_BITMAP Or NativeMethodsEX.MIIM.MIIM_STRING Or NativeMethodsEX.MIIM.MIIM_FTYPE Or NativeMethodsEX.MIIM.MIIM_STATE Or NativeMethodsEX.MIIM.MIIM_ID
.wID = WM_APP
.fType = NativeMethodsEX.MFT.MFT_STRING
.dwTypeData = String.Concat("Wrong Position")
.fState = NativeMethodsEX.MFS.MFS_ENABLED
.hbmpItem = hbitmap
End With
If ShowTop Then
NativeMethodsEX.InsertMenuItem(aHwnd, 0, True, mii)
NativeMethodsEX.InsertMenu(aHwnd, 1, NativeMethodsEX.MFT.MFT_BYPOSITION Or NativeMethodsEX.MFT.MFT_SEPARATOR, Nothing, Nothing)
Else
Dim menuItemCount As Integer = NativeMethodsEX.GetMenuItemCount(aHwnd)
NativeMethodsEX.InsertMenu(aHwnd, menuItemCount, NativeMethodsEX.MFT.MFT_BYPOSITION Or NativeMethodsEX.MFT.MFT_SEPARATOR, Nothing, Nothing)
NativeMethodsEX.InsertMenuItem(aHwnd, menuItemCount + 1, True, mii)
End If
NativeMethodsEX.DrawMenuBar(subjectRegionHwnd)
So how can I tell the menu item not to reserve the space for the check / uncheck image?
I have two answers to this problem.
I indicated above that the issue existed on an menu in Outlook 2010 but not in Outlook 2007. This is not true. These office versions are of course on different computers and it was a display setting in windows that was the cause of the problem. The above menu is what you get when you have the setting "Use Visual Styles on Windows and buttons" in Performance Options > Visual Effects turned off (Win 7). If you enable this setting then the menus look and especially act very differently.
But what if a user disables this setting how can you deal with it (Not sure if this is relevant for Win10).
You need to set the menu style through the use of the Menuinfo in particular you need to set the flag MNS_NOCHECK. Then the space is gone as the menu no longer is expecting the check marks.
This solution can also be seen here in another stackoverflow answer.

Add Image to Custom Task Pane Title in Outlook - VB.Net

I have created a custom task pane in VB.Net for Outlook using the Code given below and I would like to add more content to the header (image and a button) of the User Control instead of just the title. Is there a way I can achieve this?
myUserControl1 = New OutlookTaskPane
myUserControl1.TabStop = True
Dim width As Integer = myUserControl1.Width
myCustomTaskPane = Me.CustomTaskPanes.Add(myUserControl1, "My Custom Task Pane")
myCustomTaskPane.Width = width
myCustomTaskPane.Visible = True
myCustomTaskPane.DockPositionRestrict = Microsoft.Office.Core.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange
Let me know if there is any other way of achieving this please.
Thanks.
Unfortunately the TaskPane header is not customizable. Only Add-in Express supports similar customizations using their implementation of Advanced Form Regions (although only the header icon and header color can be changed and you can't add Windows Forms controls to it). Another option is to implement your own type of Task Pane so you have complete control over the UI; see https://code.msdn.microsoft.com/OlAdjacentWindows/.

Accessing custom task pane in active window - Visual Basic, VSTO

I'm creating a COM add-in in VSTO for Ppt 2013 and am having a problem referencing the custom task pane in the active window.
My code is supposed to make the custom task pane visible for the active window only, however it currently runs for all document windows.
My code is:
For Each CTP As Microsoft.Office.Tools.CustomTaskPane In Globals.ThisAddIn.CustomTaskPanes
If CTP.Window Is Globals.ThisAddIn.Application.ActiveWindow Then
CTP.Visible = True
End If
Next
The taskpane is added to each new presentation created/ opened using the below code
AddIn_control1 = New AddIn_control
AddIn_taskpane = Me.CustomTaskPanes.add(AddIn_control1, "Add-in taskpane", Me.Application.ActiveWindow)
I conducted a little experiment and turns out CustomTaskPane.Window is always ActiveWindow. So to workaround it you can keep tracking of tackpanes in some dictionary:
Dictionary<CustomTaskPane, PowerPoint.Presentation> ctpDict = new Dictionary<CustomTaskPane, PowerPoint.Presentation>();
void Application_AfterNewPresentation(PowerPoint.Presentation Pres) {
AddIn_control AddIn_control1 = new AddIn_control();
CustomTaskPane AddIn_taskpane = this.CustomTaskPanes.Add(AddIn_control1, "Add-In Taskpane", this.Application.ActiveWindow);
ctpDict.Add(AddIn_taskpane, Pres);
}
and later you can use it:
if (cptDict[CTP] == Globals.ThisAddIn.Application.ActivePresentation) {
CTP.Visible = true;
}

VB.NET VSTO referencing custom task panes from ribbon in multiple windows PowerPoint 2013 [duplicate]

I'm creating a COM add-in in VSTO for Ppt 2013 and am having a problem referencing the custom task pane in the active window.
My code is supposed to make the custom task pane visible for the active window only, however it currently runs for all document windows.
My code is:
For Each CTP As Microsoft.Office.Tools.CustomTaskPane In Globals.ThisAddIn.CustomTaskPanes
If CTP.Window Is Globals.ThisAddIn.Application.ActiveWindow Then
CTP.Visible = True
End If
Next
The taskpane is added to each new presentation created/ opened using the below code
AddIn_control1 = New AddIn_control
AddIn_taskpane = Me.CustomTaskPanes.add(AddIn_control1, "Add-in taskpane", Me.Application.ActiveWindow)
I conducted a little experiment and turns out CustomTaskPane.Window is always ActiveWindow. So to workaround it you can keep tracking of tackpanes in some dictionary:
Dictionary<CustomTaskPane, PowerPoint.Presentation> ctpDict = new Dictionary<CustomTaskPane, PowerPoint.Presentation>();
void Application_AfterNewPresentation(PowerPoint.Presentation Pres) {
AddIn_control AddIn_control1 = new AddIn_control();
CustomTaskPane AddIn_taskpane = this.CustomTaskPanes.Add(AddIn_control1, "Add-In Taskpane", this.Application.ActiveWindow);
ctpDict.Add(AddIn_taskpane, Pres);
}
and later you can use it:
if (cptDict[CTP] == Globals.ThisAddIn.Application.ActivePresentation) {
CTP.Visible = true;
}

Tooltip on Outlook Add-in Ribbon

I created a outlook add-in using VSTO 2008. I didn't create a separate ribbon/group for this add-in. Instead VSTO automatically create the add-in button in the built-in Ribbon when Outlook starts.
Now how do I customize the tooltip of that add-in icon?
Here is the snippet to add label and icon for my add-in
[Microsoft.Office.Tools.Outlook.FormRegionMessageClass("IPM.Note.DougForm")]
[Microsoft.Office.Tools.Outlook.FormRegionName("Doug.Note.FormTest")]
public class QMemoRegionFactory : QRegionFactory, Microsoft.Office.Tools.Outlook.IFormRegionFactory
{
public DougFormTest()
{
this._Manifest.FormRegionName = "DougForm";
this._Manifest.Icons.Page = global::DougForm.OutlookAddin.Properties.Resources.DougIcon_big;
}
...
Thanks
Does you app generate any ribbon XML that you know of? The property names that can set tooltip text for buttons on a Ribbon are ScreenTip and SuperTip.
Alternatively, create your own custom ribbon XML and set the label, icon, and screentip to be whatever you want.
http://msdn.microsoft.com/en-us/library/aa942866(VS.80).aspx