TaskPaneObject interface

Represents a task pane in a Microsoft Office InfoPath form that is associated with a window.

Namespace:  Microsoft.Office.Interop.InfoPath
Assembly:  Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.dll)

<GuidAttribute("096CD58E-0786-11D1-95FA-0080C78EE3BB")> _
Public Interface TaskPaneObject _
	Inherits TaskPane
Dim instance As TaskPaneObject

This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, seeTaskPane.

The TaskPaneObject object provides properties for working with the InfoPath built-in task panes. The HTMLTaskPaneObject object inherits those properties for working with a custom task pane.

The properties available for an InfoPath task pane are determined by the type of task pane that you are working with. If the TaskPaneType property returns 0, the task pane is a custom task pane and the properties and methods available are provided by the HTMLTaskPane object. If the TaskPaneType property returns any other value, the task pane is a built-in task pane and the properties are provided by the TaskPaneObject object.


TaskPaneType is based on XdTaskPaneType enumeration. These enumerated values are also used as arguments to the property Item of the TaskPanesCollection collection for returning a reference to a specified type of task pane.

In the following example, the Item property of the TaskPanesCollection collection is used to get a reference to the TaskPane object that represents the custom task pane. The code then calls a scripting function defined in the HTML code of the custom task pane using the HTMLDocument property of the HTMLTaskPaneObject object, which is inherited by the TaskPane object.

// Ensure View has loaded before trying to access the task pane.
if (thisXDocument.View != null)
 // Get a reference to the custom task pane.  It is always the 0-th
 // task pane in the TaskPanes collection.
 HTMLTaskPane custom = (HTMLTaskPane) thisXDocument.View.Window.TaskPanes[0];

 // Ensure that the task pane is completely loaded.
 if (custom != null && custom.HTMLDocument.readyState == "complete")
  mshtml.IHTMLWindow2 window = custom.HTMLDocument.parentWindow;

  object[] args =  new object[] {"ViewID"};

  // call into script through CLR late binding mechanism
   "SelectView",      // late bound method      
   System.Reflection.BindingFlags.InvokeMethod |   // binding flags
   System.Reflection.BindingFlags.DeclaredOnly | 
   System.Reflection.BindingFlags.Public | 
   null,        // binder object
   window,        // target object

The above example requires a reference to the Microsoft.mshtml.dll assembly.